Database changed
mysql> update mysql.user set authentication_string=password('账号密码') where user='root';
Query OK, 0 rows affected, 1 warning (0.03 sec)
Rows matched: 3 Changed: 0 Warnings: 1
mysql> update user set plugin="mysql_native_password";
Query OK, 1 row affected (0.00 sec)
Rows matched: 7 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
3./etc/mysql/mysql.conf.d/mysqld.cnf文件,去掉skip-grant-tables,开启校验
4.重启服务
sudo service mysql restart;
至此就搞定了,使用jdbc、非Linux root账号都可以登录了。
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx