如何找回mysql密碼
『壹』 怎樣找到mysql的用戶名和密碼
方法和詳細的操作步驟如下:
方法和詳細的操作步驟如下:
1、第一步,打開Navicat並找到mysql,見下圖,轉到下面的步驟。
『貳』 mysql登錄密碼忘記了怎麼辦
msyqld_saft方式找回密碼
停止mysql:service mysqld stop;
安全模式啟動:mysqld_safe –skip-grant-tables &
無密碼回車鍵登錄:mysql -uroot –p
重置密碼:use mysql; update user set password=password('') where user=』root』 and host=』localhost』; flush privileges;
正常啟動:service mysql restart
再使用mysqladmin: mysqladmin password '123456'
『叄』 mysql資料庫密碼忘了怎麼辦
mysql -uroot -p 輸入密碼回車後,出現如下圖錯誤。這時候需要我們破解密碼。
service mysqld stop //先停止mysql服務。
然後打開mysql配置文件/etc/my.cnf.在【mysqld】下面添加一行代碼:skip-grant-tables。這行代碼意思就是跳過跳過授權表,即是可以跳過密碼驗證直接進入資料庫。
3
service mysqld restart //重啟mysql資料庫。假如不重啟的話,不會生效。
mysql -uroot -p //此時直接回車,既可以進入資料庫。
出現mysql>就說明你已經進入到mysql資料庫里了。
『肆』 MySQL密碼忘了怎麼辦
MySQL密碼忘了的操作:
1.關閉MySQL資料庫,因為root密碼忘記了,mysqladmin無法使用,此時,只能通過killpid關閉程序。在這里,科普一下kill和kill-9的區別默認參數下,kill發送SIGTERM信號給進程。
告訴進程,你需要被關閉,請自行停止運行並退出。kill-9發送SIGKILL信號給進程,告訴進程,你被終結了,請立刻退出。與SIGTERM相比,這個信號不能被捕獲或忽略,同時接收這個信號的進程在收到這個信號時不能執行任何清理所以。
萬不得已,不要通過kill-9殺掉進程,這可能導致MySQL資料庫的物理結構損壞,無法重新啟動。
2.在my.cnf文件部分添加skip-grant-tables參數。
3.登錄資料庫,修改root賬戶的密碼以下是修改root密碼的三種方式:
1>mysql>setpasswordfor'root'@'localhost'=password('123')。無需刷新許可權表。
2>mysql>updatemysql.usersetpassword=password("456")whereuser="root"andhost="localhost"。
mysql>flushprivileges;3>#mysqladmin-urootpassword"123"。
4.關閉資料庫,注釋掉skip-grant-tables參數,重新啟動資料庫。上面這種方式雖然不錯,但是有個問題,你必須重啟資料庫,對於線上環境,這可能是不被允許的。
『伍』 如何找回 MySQL 的密碼
如果只是想看原來的密碼的話。可以在命令行執行這個語句
select
host,user,password
from
mysql.user;
如果要修改密碼的話,在命令行下執行下面的語句
update
mysql.user
set
password='這里填寫你要設置的密碼'
where
user='root';
參考:php程序員,雷雪松的個人博客。
『陸』 mysql忘記密碼怎麼找回
1.修改本地mysql目錄中的my.ini文件
添加skip-grant-tables
2.在win +r 輸入cmd,進行mysql的重啟啟動操作
3.直接輸入mysql -uroot -p
然後不輸入密碼直接回車就可以進入資料庫
執行sql修改root用戶的密碼:
update user set authentication_string = password("123456") where user = "root";
再次進去就OK啦
最後的最後,記得把之前加進去my.ini的skip-grant-tables重新刪掉~
『柒』 忘記了本地mysql密碼應該怎麼找回
Windows下的實際操作如下
1.關閉正在運行的MySQL。
2.打開DOS窗口,轉到mysql\bin目錄。
3.輸入mysqld --skip-grant-tables回車。如果沒有出現提示信息,那就對了。
4.再開一個DOS窗口(因為剛才那個DOS窗口已經不能動了),轉到mysql\bin目錄。
5.輸入mysql回車,如果成功,將出現MySQL提示符 >
6. 連接許可權資料庫>use mysql; (>是本來就有的提示符,別忘了最後的分號)
6.改密碼:> update user set password=password("520") where user="root"; (別忘了最後的分號)
7.刷新許可權(必須的步驟)>flush privileges;
8.退出 > \q
9.注銷系統,再進入,開MySQL,使用用戶名root和剛才設置的新密碼123456登陸。
第一步
C:\Documents and Settings\Administrator>cd D:\web\www.php100.com\Mysql\MySQL Se
rver5.5\bin
C:\Documents and Settings\Administrator>d:
D:\web\www.php100.com\Mysql\MySQL Server5.5\bin>mysqld --skip-grant-tables
第二步
Microsoft Windows [版本 5.2.3790]
(C) 版權所有 1985-2003 Microsoft Corp.
C:\Documents and Settings\Administrator>cd D:\web\www.php100.com\Mysql\MySQL Se
rver5.5\bin
C:\Documents and Settings\Administrator>d:
D:\web\www.php100.com\Mysql\MySQL Server5.5\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.10 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
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;
Database changed
mysql> update user set password=password("520") where user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
D:\web\www.php100.com\Mysql\MySQL Server5.5\bin>
追問:
cmd打開窗口,輸入mysql\bin顯示系統找不到路徑。
輸入mysqld --skip-grant-tables