1.Ubuntu中查看mysql的用户名和密码:
sudo cat /etc/mysql/debian.cnf
2.使用user和password登陆mysql
use mysql
update mysql.user set authentication_string=password('mysql') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;
3.完成修改后重启mysql服务器
sudo service mysql restart
[client]
host = localhost
user = debian-sys-maint
password = uzBvDkzQ9o7PzhjG
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = uzBvDkzQ9o7PzhjG
socket = /var/run/mysqld/mysqld.sock










网友评论