Linux下MySQL 5.7.23无法远程连接解决方案(2)

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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/39c408f86a440c073361cafa7636012f.html