mysql> update user set password=password('123') where user='root' and host='localhost';
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 '('123') where user='root' and host='localhost'' at line 1
mysql> alter user root@localhosten identified by'123456';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhosten'
mysql> alter user root identified by'123456';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'
mysql> alter user user() identified by "";
ERROR 1396 (HY000): Operation ALTER USER failed for 'ODBC'@'skip-grants host'
mysql> ALTER USER'root'@'%'IDENTIFIED WITH mysql_native_password BY 'password';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'
mysql> select user from user;
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> select user from user;
+------------------+
| user |
+------------------+
| mysql.infoschema |
| mysql.session |
| mysql.sys |
| root |
+------------------+
4 rows in set (0.00 sec)
通过跳过密码的方式进入了MySQL,然后试图修改密码,在修改MySQL密码过程中遇到了很多次报1064错,但最终并不清楚这个错是怎么来的,换了很多种改密码的命令行,但是都不行,后来直接重新建了一个:
mysql> drop user root@localhost;
Query OK, 0 rows affected (0.24 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.12 sec) mysql> create user root@localhost identified by '123456';
Query OK, 0 rows affected (0.24 sec) mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)