~# sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
----------------------------------------------------------------
skip-grant-tables
-----------------------------------------------------------------
~# mysql -uroot -p
~# use mysql;
~# flush privileges;
~# ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
~# flush privileges;
备注: 一定要先刷新 flush privileges;
网友评论