当前位置:Gxlcms > 数据库问题 > ubuntu mysql5.7 解决不用密码也能登录

ubuntu mysql5.7 解决不用密码也能登录

时间:2021-07-01 10:21:17 帮助过:4人阅读

在ubuntu下载mysql后,用mysql命令就可以直接登录数据库了,这是因为在mysql.user表里有个plugin的字段,root这个用户的值是auth_socket, 需要把它改成mysql_native_password。具体步骤如下:

use mysql;
update user set authentication_string=PASSWORD("密码") where user=‘root‘; update user set plugin="mysql_native_password"; flush privileges;quit;
/etc/init.d/mysql restart; mysql -u root -p 密码;

ubuntu mysql5.7 解决不用密码也能登录

标签:string   用户   sql   密码   str   root   tar   password   use   

人气教程排行