sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf [mysqld]下加入”skip-grant-tables”
sudo /etc/init.d/mysql restart
mysql -u root
update mysql.user set authentication_string=password(’123456′) where user=’root’;(mysql5.7取消了password字段)
update user set plugin=”mysql_native_password”;
flush privileges;
exit;
注释 [mysqld]下加入”skip-grant-tables”
sudo /etc/init.d/mysql restart
mysql -u root -p123456