ubuntu设置MySQL密码

1.启动mysql服务器2. 查看临时用户和密码3.用临时密码登录4.修改root用户密码5.退出MySQL,使密码生效

1.启动mysql服务器

service mysql start

2. 查看临时用户和密码

sudo cat /etc/mysql/debian.cnf

3.用临时密码登录

mysql -u debian-sys-maint -p

4.修改root用户密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mynewpassword';

5.退出MySQL,使密码生效

exit退出MySQL,在终端命令行输入:

sudo mysql_secure_installation

参考文章: MYSQL设置密码时显示Failed! Error: SET PASSWORD has no significance for user ‘root‘@‘localhost‘ as the authe

好文阅读

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: