MySql创建用户的指定密码的加密规则命令如下:
create user 'mtoo'@'localhost' identified WITH mysql_native_password by 'mypassword';
FLUSH PRIVILEGES;
效果如下:
mysql> select host, user,plugin from user;
Connection id: 261
Current database: mysql
+-----------+------------------+-----------------------+
| host | user | plugin |
+-----------+------------------+-----------------------+
| localhost | user1 | mysql_native_password |
| localhost | mtoo | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
| localhost | root | caching_sha2_password |
+-----------+------------------+-----------------------+
6 rows in set (0.01 sec)
一般我们需要的正是指定加密规则mysql_native_password。翻了好多地方都没有找到,最后还是自己领悟出来的。
MYSQL系列文章
MySQL8 启动报错Warning: World-writable config file '/etc/my.cnf’ is ignored
MySQL Authentication plugin 'caching_sha2_password' cannot be loaded
原创作品,禁止转载!