Linux(CentOS)下重置MySQL根(Root)密码,以及远程登录mysql连接IP受限问题解决

一 、Linux(CentOS)下重置MySQL根(Root)密码 (参考:http://www.jb51.net/article/108700.htm

1、“service mysqld status”查看当前mysql服务状态

2、“killall -TERM mysqld”命令停止所有的mysqld进程。

3、“service mysqld stop”命令停止mysqld服务。

4、“mysqld_safe  --skip-grant-tables &”命令以无密码方式进入MySQL安全模式。

5、“mysql -u root”并按回车键即可。

6、“use mysql;”挂载数据库。

7、"update user set password=password("New9ssw0rd") where user='root';"将Root密码修改为New9ssw0rd。

8、"flush privileges;"更新权限。

9、“quit”并按回车键退出。

10、"service mysqld restart"重启mysqld服务。

11、“mysql -u root -p”并按回车键提示输入密码。

二  、远程登录mysql连接IP受限问题解决

1、use mysql;

2、select host,user,password from user;

3、GRANT ALL ON *.* TO root@'授权的IP' IDENTIFIED BY '你的密码';

猜你喜欢

转载自www.cnblogs.com/daacheng/p/9006431.html
今日推荐