9

linux 修改MySQL root密码方法之一

 3 years ago
source link: https://www.liurongxing.com/linux-mysql-root-password.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

linux 修改MySQL root密码方法之一

作者: JavasBoy 分类: MySQL 发布时间: 2012-04-24 14:41 ė 17,269 views 6 没有评论

如果 MySQL 正在运行,首先结束mysql进程:

service mysql stop
or
ps aux | grep mysql
killall mysqld

#启动 MySQL (非正常方式起动):

mysqld_safe --skip-grant-tables &

这样就可以不需要密码进入 MySQL :

mysql -u root -p #要求输入密码时直接回车即可
mysql> use mysql
mysql> UPDATE user SET Password=PASSWORD ('新密码') where USER='root';
mysql> flush privileges;
mysql> quit;

重新结束进程:

service mysql stop
or
ps aux | grep mysql
killall mysqld

用正常方式启动 MySQL :

service mysql start

发表评论 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

评论

显示名称 *

电子邮箱地址 *

网站网址


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK