命令

mysql -u root -p
use mysql
select user,host,plugin from user;
alter user 'haidragon'@'%' identified with mysql_native_password by 'pass123';
select user,host,plugin from user;
exit
mysql.server restart (mac)

192:etc haidragon$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 8.0.15 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql Database changed mysql> select user,host,plugin from user; +------------------+-----------+-----------------------+ | user | host | plugin | +------------------+-----------+-----------------------+ | haidragon | % | caching_sha2_password | | mysql.infoschema | localhost | caching_sha2_password | | mysql.session | localhost | caching_sha2_password | | mysql.sys | localhost | caching_sha2_password | | root | localhost | caching_sha2_password | +------------------+-----------+-----------------------+ 5 rows in set (0.00 sec)

mysql> alter user 'haidragon'@'%' identified with mysql_native_password by 'pass123' -> ; Query OK, 0 rows affected (0.01 sec)

mysql> select user,host,plugin from user; +------------------+-----------+-----------------------+ | user | host | plugin | +------------------+-----------+-----------------------+ | haidragon | % | mysql_native_password | | mysql.infoschema | localhost | caching_sha2_password | | mysql.session | localhost | caching_sha2_password | | mysql.sys | localhost | caching_sha2_password | | root | localhost | caching_sha2_password | +------------------+-----------+-----------------------+ 5 rows in set (0.00 sec)

mysql> exit Bye 192:etc haidragon$ sqlite3 Display all 116 possibilities? (y or n) 192:etc haidragon$ sqlit 192:etc haidragon$ my my_print_defaults mysql_secure_installation mysqldump myisam_ftdump mysql_ssl_rsa_setup mysqldumpslow myisamchk mysql_tzinfo_to_sql mysqlimport myisamlog mysql_upgrade mysqlpump myisampack mysqladmin mysqlrouter mysql mysqlbinlog mysqlrouter_plugin_info mysql.server mysqlcheck mysqlshow mysql_client_test mysqld mysqlslap mysql_config mysqld_multi mysqltest mysql_config_editor mysqld_safe mysqlxtest 192:etc haidragon$ mysql.server restart Shutting down MySQL .. SUCCESS! Starting MySQL .. SUCCESS! 192:etc haidragon$ 参考: https://blog.csdn.net/myNameIssls/article/details/84031426