Warning The MySQL user name length limit is hardcoded in MySQL servers and clients, and trying to circumvent it by modifying the definitions of the tables in the mysql database does not work.
You should never alter the structure of tables in the mysql database in any manner whatsoever except by means of the procedure that is described in Section 2.11, “Upgrading MySQL”. Attempting to redefine MySQL's system tables in any other fashion results in undefined and unsupported behavior. The server is free to ignore rows that become malformed as a result of such modifications.
mysql> update user set authentication_string =PASSWORD('123456') where user='root' and host='%' ;
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 '('
123456') where user='root' and host='%'' at line 1
mysql>
--奇怪的是使用alter命令重置root密码长度为6位时报错,但是不是语法错误
mysql> alter user 'root'@'%' identified by '123456'; ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%' --但是,将root密码长度增加到8位时获得成功
mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY '123456789';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select user,host,authentication_string from mysql.user;