大概過程
在mysql裡設密碼開啟IE輸入網址localhostphpadmin之後,點使用者看到有root使用者,往下拉,找到修改密碼的地方,輸入密碼,進行執行操作,最後再去到在你的xampp安裝目錄下找到phpadmin檔案夾,開啟找到config.inc.php檔案之後,開啟找關於mysql配置將config改為cookie 該密碼的地方該成剛才設定的密碼就可以了。
具體方法
在瀏覽器地址上輸入http://localhost/phpmyamdin 進入到資料庫控制台,然後選擇名稱為mysql資料庫,如圖,可從中看出 user表中,root的兩個使用者的密碼為空白。
我們可以手動編輯上圖資料庫中的root使用者的密碼即可。點快速編輯,或者編輯都可以編輯密碼,如密碼 :123456 ,則填寫 “*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9” (引號除外)
編輯後如下圖
如果想把密碼改成別的,可以直接執行西面的SQL 陳述式,把new_password改成自己的密碼即可:
|
1
|
UPDATE user SET password=PASSWORD(
'new_password'
) WHERE user=
'root'
;
|
另外既然mysql的root使用者密碼已經修改了,那麼phpmyadmin中的對應密碼配置也要修改,找到設定檔,如我的是
F: mppphpMyAdminconfig.inc.php
找到如下代碼
| 代碼如下 |
複製代碼 |
| Authentication type and info */$cfg['Servers'][$i]['auth_type'] = 'config';$cfg['Servers'][$i]['user'] = 'root';$cfg['Servers'][$i]['password'] = '';$cfg['Servers'][$i]['extension'] = 'mysql';$cfg['Servers'][$i]['AllowNoPassword'] = true; |
修改為
| 代碼如下 |
複製代碼 |
| Authentication type and info */$cfg['Servers'][$i]['auth_type'] = 'config';$cfg['Servers'][$i]['user'] = 'root';$cfg['Servers'][$i]['password'] = '123456';$cfg['Servers'][$i]['extension'] = 'mysql';$cfg['Servers'][$i]['AllowNoPassword'] = true; |
這樣就會需要重啟登入phpmyadmin了。