系統環境:centos
操作方法:
1.殺掉mysql程序
方法1、[root@localhost /]#killall mysqld
方法2、[root@localhost /]#ps -aux //檢視所有程序,找到mysql程序的pid
然後 [root@localhost /]#kill pid //pid是mysql的程序號
2.用--skip-grant-tables引數啟動mysqld
[root@localhost /]#/usr/local/mysql/bin/mysqld_safe --skip-grant-tables&
// 其中/usr..../bin是我的mysql安裝目錄
[root@localhost /]#/usr/local/mysql/bin/
[root@localhost /]# ./mysql
eg:[root@localhost bin]# ./mysql
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 1
server version: 5.1.60-log source distribution
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
是否看到了希望??呵呵
mysql> use mysql //切換到mysql database
mysql> update user set password=password('123456') where user='root';
//將root密碼該為123456了
搞定!
mysql忘記root密碼的解決
一.mysql密碼的恢復方法之一 如果忘記了mysql的root密碼,可以用以下方法重新設定 1.kill掉系統裡的mysql程序 killall term mysqld 2.用以下命令啟動mysql,以不檢查許可權的方式啟動 safe mysqld skip grant tables 3.然後用空...
解決 MySQL忘記root密碼 windows
在windows中 1 以系統管理員身份執行cmd 2 停止mysql net stop mysql.3 切換到mysql安裝路徑下 d wamp mysql 5.6.36 bin 如果已經配了環境變數,可以不用切換了。4 在命令列輸入 mysqld nt skip grant tables這裡可能...
mysql忘記root密碼的解決
引用 一.mysql密碼的恢復方法之一 如果忘記了mysql的root密碼,可以用以下方法重新設定 1.kill掉系統裡的mysql程序 killall term mysqld 2.用以下命令啟動mysql,以不檢查許可權的方式啟動 safe mysqld skip grant tables 3.然...