Linux 拨号vps windows公众号手机端

ubuntu中mysql改密码忘了怎么办

lewis 7年前 (2018-11-17) 阅读数 9 #VPS/云服务器

ubuntu中mysql改密码忘了的解决方法:

1.在终端中切换到root权限,命令:

su root

2. 停止mysqld,输入命令:

/etc/init.d/mysql stop

3. 以不检查权限的方式启动MySQL,命令:

mysqld --skip-grant-tables &

4. 用空密码方式使用root用户登录MySQL,命令:

mysql -u root

5. 修改root用户的密码为123456,命令如下:

mysql> update mysql.user set password=PASSWORD('123456') where User='root';

mysql> flush privileges;

mysql> quit

6.重新启动MySQL即可。命令:

/etc/init.d/mysql restart

版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门