本文共 2550 字,大约阅读时间需要 8 分钟。
命令
mysql -u root -puse mysqlselect user,host,plugin from user;alter user 'haidragon'@'%' identified with mysql_native_password by 'pass123';select user,host,plugin from user;exitmysql.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 18Server version: 8.0.15 HomebrewCopyright (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 respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Database changedmysql> 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
Bye192:etc haidragon$ sqlite3 Display all 116 possibilities? (y or n)192:etc haidragon$ sqlit192:etc haidragon$ mymy_print_defaults mysql_secure_installation mysqldumpmyisam_ftdump mysql_ssl_rsa_setup mysqldumpslowmyisamchk mysql_tzinfo_to_sql mysqlimportmyisamlog mysql_upgrade mysqlpumpmyisampack mysqladmin mysqlroutermysql mysqlbinlog mysqlrouter_plugin_infomysql.server mysqlcheck mysqlshowmysql_client_test mysqld mysqlslapmysql_config mysqld_multi mysqltestmysql_config_editor mysqld_safe mysqlxtest192:etc haidragon$ mysql.server restartShutting down MySQL.. SUCCESS! Starting MySQL.. SUCCESS! 192:etc haidragon$ 参考:转载于:https://blog.51cto.com/haidragon/2349084