数据库操作不成功,74啦!!
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘rootroot’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘rootroot’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘Root1234’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘Root1234’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘Root123.’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘Root123.’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘Root1234.’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘Root1234.’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘rooT123.’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘rooT123.’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘Root123;’; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘Root123' at line 1 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '’' at line 1 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY 'Root123.'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> ALTER USER 'root'@'hdp2' IDENTIFIED WITH mysql_native_password BY 'Root123.'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> ALTER USER 'root'@'hdp2' IDENTIFIED WITH mysql_native_password BY 'rootA1234;'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> ALTER USER 'root'@'hdp2' IDENTIFIED WITH mysql_native_password BY 'rootA1234#'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set password for root@hdp2 = password('root'); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('root')' at line 1 mysql> set password for root@hdp2 = password('rooT123#'); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('rooT123#')' at line 1 mysql> use mysql; No connection. Trying to reconnect... Connection id: 9 Current database: *** NONE *** ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> use mysql No connection. Trying to reconnect... Connection id: 10 Current database: *** NONE *** ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> update user set authentication_string='' where user='root'; ERROR 1046 (3D000): No database selected mysql> ALTER USER USER() IDENTIFIED BY 'wingkin45'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements mysql> set global validate_password_policy=LOW; ERROR 1193 (HY000): Unknown system variable 'validate_password_policy' mysql> alter user 'root'@'hdp2' identified by 'Root@123456'; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> use mysql; No connection. Trying to reconnect... Connection id: 11 Current database: *** NONE *** ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> SET SESSION wait_timeout=600; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set global validate_password.policy=0; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set global validate_password.length=1; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set global validate_password_policy=0; ERROR 1193 (HY000): Unknown system variable 'validate_password_policy' mysql> set global validate_password_length=1; ERROR 1193 (HY000): Unknown system variable 'validate_password_length'
改配置文件,重启MySQL
在my.cnf中添加:
[mysqld]
skip-grant-tables
推荐个大佬的文章,能量感爆棚;
小编的目的是用MySQL做hive元数据管理用,So. i need one passwrod of the mysql8040
0、先给你个空空
use mysql;
update user set authentication_string = "" where user = "root";
1、要注解skip-grant-tables
2、要生成自己定义的密码
[mysqld]
#skip-grant-tables
重启原神:
systemctl restart mysqld
mysql> use mysql
No connection. Trying to reconnect...
Connection id: 9
Current database: *** NONE ***
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
(大致意思是:先用ALTER USER给我修改个密码,我有条件长度大于8,有大小写、有特殊符号还有数字)
mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'root';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
(密码不符合条件)
mysql> ALTER user 'root'@'localhost' IDENTIFIED BY 'Root123@4';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
(刷新新)
看到authentication_string有值,且是字符串,就证明成功了。
mysql> select plugin,Host,User,authentication_string from user;
+-----------------------+-----------+------------------+------------------------------------------------------------------------+
| plugin | Host | User | authentication_string |
+-----------------------+-----------+------------------+------------------------------------------------------------------------+
| caching_sha2_password | localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| caching_sha2_password | localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| caching_sha2_password | localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| caching_sha2_password | localhost | root | $A$005$qd%_zJ.[s.+F7u:xDy/3uKO0R6AT6If/pPFwt4qa2JDCW608JuNobUhPcl. |
+-----------------------+-----------+------------------+------------------------------------------------------------------------+
疑问:我不注解skip-grant-tables会发生什么?
会报错呀!烧脑ing!
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
注解后重启原神,回到"小编"开始操作ING!