MySQL忘记密码怎么办
2016-08-19 17:13
197 查看
如果有一天你忘记了root的密码,我们可以利用 --skip-grant-tables这个参数,具体实施如下:
[root@HE1 bin]# mysql -uroot -pEnter password:ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)[root@HE1 bin]# ps-ef|grep mysqlroot 7572 2398 0 00:58 pts/1 00:00:00 /bin/sh ./mysqld_safe--defaults-file=/etc/my.cnfmysql 8199 7572 0 00:58 pts/1 00:00:00 /usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql--plugin-dir=/usr/local/mysql/lib/plugin --user=mysql--log-error=/data/mysql/error.log --open-files-limit=3072--pid-file=/data/mysql/HE1.pid --socket=/data/mysql.sock --port=3306root 8230 2398 0 00:59 pts/1 00:00:00 grep mysql[root@HE1 bin]# kill -9 8199 7572[root@HE1 bin]# ps-ef|grep mysqlroot 8232 2398 0 00:59 pts/1 00:00:00 grep mysql[1]+ Killed ./mysqld_safe--defaults-file=/etc/my.cnf[root@HE1 bin]# ps-ef|grep mysqlroot 8234 2398 0 00:59 pts/1 00:00:00 grep mysql[root@HE1 bin]# ./mysqld_safe --defaults-file=/etc/my.cnf--skip-grant-tables &[1] 8235[root@HE1 bin]#160317 00:59:43 mysqld_safe Logging to '/data/mysql/error.log'.160317 00:59:43mysqld_safe Starting mysqld daemon with databases from /data/mysql [root@HE1 bin]# mysql -urootWelcome to the MySQLmonitor. Commands end with ; or \g.Your MySQLconnection id is 1Server version:5.6.16-log MySQL Community Server (GPL) Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved. Oracle is aregistered trademark of Oracle Corporation and/or itsaffiliates. Othernames may be trademarks of their respectiveowners. Type 'help;' or '\h'for help. Type '\c' to clear the current input statement. mysql> quitBye[root@HE1 bin]# mysqlWelcome to the MySQLmonitor. Commands end with ; or \g.Your MySQLconnection id is 2Server version:5.6.16-log MySQL Community Server (GPL) Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved. Oracle is aregistered trademark of Oracle Corporation and/or itsaffiliates. Othernames may be trademarks of their respectiveowners. Type 'help;' or '\h'for help. Type '\c' to clear the current input statement. mysql> quitBye
本文中采用kill-9的方式,这种方式不建议在生产库中使用,生产库中应采用正常停库
本文出自 “岁伏” 博客,请务必保留此出处http://suifu.blog.51cto.com/9167728/1753985
[root@HE1 bin]# mysql -uroot -pEnter password:ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password: YES)[root@HE1 bin]# ps-ef|grep mysqlroot 7572 2398 0 00:58 pts/1 00:00:00 /bin/sh ./mysqld_safe--defaults-file=/etc/my.cnfmysql 8199 7572 0 00:58 pts/1 00:00:00 /usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql--plugin-dir=/usr/local/mysql/lib/plugin --user=mysql--log-error=/data/mysql/error.log --open-files-limit=3072--pid-file=/data/mysql/HE1.pid --socket=/data/mysql.sock --port=3306root 8230 2398 0 00:59 pts/1 00:00:00 grep mysql[root@HE1 bin]# kill -9 8199 7572[root@HE1 bin]# ps-ef|grep mysqlroot 8232 2398 0 00:59 pts/1 00:00:00 grep mysql[1]+ Killed ./mysqld_safe--defaults-file=/etc/my.cnf[root@HE1 bin]# ps-ef|grep mysqlroot 8234 2398 0 00:59 pts/1 00:00:00 grep mysql[root@HE1 bin]# ./mysqld_safe --defaults-file=/etc/my.cnf--skip-grant-tables &[1] 8235[root@HE1 bin]#160317 00:59:43 mysqld_safe Logging to '/data/mysql/error.log'.160317 00:59:43mysqld_safe Starting mysqld daemon with databases from /data/mysql [root@HE1 bin]# mysql -urootWelcome to the MySQLmonitor. Commands end with ; or \g.Your MySQLconnection id is 1Server version:5.6.16-log MySQL Community Server (GPL) Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved. Oracle is aregistered trademark of Oracle Corporation and/or itsaffiliates. Othernames may be trademarks of their respectiveowners. Type 'help;' or '\h'for help. Type '\c' to clear the current input statement. mysql> quitBye[root@HE1 bin]# mysqlWelcome to the MySQLmonitor. Commands end with ; or \g.Your MySQLconnection id is 2Server version:5.6.16-log MySQL Community Server (GPL) Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved. Oracle is aregistered trademark of Oracle Corporation and/or itsaffiliates. Othernames may be trademarks of their respectiveowners. Type 'help;' or '\h'for help. Type '\c' to clear the current input statement. mysql> quitBye
本文中采用kill-9的方式,这种方式不建议在生产库中使用,生产库中应采用正常停库
本文出自 “岁伏” 博客,请务必保留此出处http://suifu.blog.51cto.com/9167728/1753985
相关文章推荐
- MySQL密码忘记后该怎么办
- MySQL忘记密码怎么办
- redhat enterpriseredhat 5.4 下mysql忘记密码怎么办
- MySQL忘记root用户密码怎么办?
- 忘记了mysql的密码怎么办?
- mysql密码忘记了 怎么办
- mysql 忘记 root 密码怎么办?
- 忘记了mysql的root密码,怎么办?
- mysql忘记密码了怎么办?
- MySQL 忘记密码怎么办
- 忘记mysql密码怎么办
- 忘记Mysql的root密码怎么办!
- 忘记MySQL的密码怎么办?
- Ubuntu下忘记mysql密码怎么办?
- mysql忘记密码怎么办?~
- 忘记了Mysql的root用户的密码,怎么办?
- mysql 忘记密码怎么办
- MySQL忘记root密码怎么办?
- 忘记了MySQL密码怎么办
- 忘记了Mysql的root用户的密码,怎么办?