phpmyadmin默認用戶名密碼及密碼修改
一、一般默認情況
搭建本地網站的phpstudy軟體,點擊進入管理MYSQL資料庫一般情況下:
本地的phpmyadmin用戶名是:root 密碼為:root 或為空
(一般如果PhpMyAdmin跟空間位於同一主機下的話,大部分用戶名跟密碼是共用的,也就是空間的用戶名跟密碼與PhpMyAdmin的是同一個,如果是在不同的主機下的話,可能就不同了。)
二、直接更改
1、my.ini裡面找到mysqld配置項
[mysqld]
port=3306
下面添加 skip-grant-tables 之後可跳過密碼輸入 進入命令端
2、之後更改密碼 輸入:update mysql.user set password=password("新密碼") where user=root;
3、改完密碼後,刪除my.ini裡面添加的 skip-grant-tables 就可以了
三、phpmyadmin不需要密碼登錄的設置方法 :
下了最新版的phpmyadmin,裝上後輸入用戶名root然後點登錄,因為我在本地,所以root沒有密碼,結果老是報訪問被拒絕的錯誤.
$cfg["Servers"][$i]["AllowNoPasswordRoot"] = false;
我想這可能是他為了安全著想吧,讓人一定設root密碼,呵呵,不過我認為在測試的時候有點不方便,一般本地的root用戶都是空的.
其實他可以把提示語句改下,說是你的root密碼為空,以當前的安全級別不允許登錄,可以到XXX地方把設置改過來,這樣可能會明白些,單一個訪問被拒絕太難找原因了.
同時將代碼如下:
設置資料庫教程連接密碼設為空密碼,即告成功.
四、PHP設置phpMyAdmin設置登錄密碼
phpMyAdmin直接與MYSQL相連,因此安全性來說非常關鍵,有的朋友為了圖方便,根本沒有為phpMyAdmin設置一個登錄密碼,這樣很危險,若這個地址被別人知道,那你的MYSQL就完了。所以為了安全起見,我們還是要為phpMyAdmin設置一個密碼,一般情況下,這個密碼是和MYSQL密碼是一致的,默認狀態下,phpMyAdmin沒有開啟讓登錄再進入的功能,我們可以通過以下代碼開啟這項功能:
這裡的參數有三種,cookie是其中之一,其中還有兩個參數是config和http,config的意思是: 按配置文件中的密碼 (也就是標準方式) 這種方式沒有認證;http : 使用HTTP認證;cookie : 使用COOKIE登錄認證。如果是使用IIS+PHP的方式,則HTTP認證是無效的,這個功能只能在APACHE伺服器環境下使用。一般情況下,都是使用的COOKIE方式。
五、
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* phpMyAdmin sample configuration, you can use it as base for
* manual configuration. For easier setup you can use setup/
*
* All directives are explained in Documentation.html and on phpMyAdmin
*
* @version $Id$
* @package phpMyAdmin
*/
/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg["blowfish_secret"] = ""; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg["Servers"][$i]["auth_type"] = "cookie";
/* Server parameters */
$cfg["Servers"][$i]["host"] = "SQL主機";
$cfg["Servers"][$i]["connect_type"] = "tcp";
$cfg["Servers"][$i]["compress"] = SQL用戶名;
/* Select mysqli if your server has it */
$cfg["Servers"][$i]["extension"] = "mysql";
$cfg["Servers"][$i]["AllowNoPassword"] = SQL密碼;
/* rajk - for blobstreaming */
$cfg["Servers"][$i]["bs_garbage_threshold"] = 50;
$cfg["Servers"][$i]["bs_repository_threshold"] = "32M";
$cfg["Servers"][$i]["bs_temp_blob_timeout"] = 600;
$cfg["Servers"][$i]["bs_temp_log_threshold"] = "32M";
/* User for advanced features */
// $cfg["Servers"][$i]["controluser"] = "pma";
// $cfg["Servers"][$i]["controlpass"] = "pmapass";
/* Advanced phpMyAdmin features */
// $cfg["Servers"][$i]["pmadb"] = "phpmyadmin";
// $cfg["Servers"][$i]["bookmarktable"] = "pma_bookmark";
// $cfg["Servers"][$i]["relation"] = "pma_relation";
// $cfg["Servers"][$i]["table_info"] = "pma_table_info";
// $cfg["Servers"][$i]["table_coords"] = "pma_table_coords";
// $cfg["Servers"][$i]["pdf_pages"] = "pma_pdf_pages";
// $cfg["Servers"][$i]["column_info"] = "pma_column_info";
// $cfg["Servers"][$i]["history"] = "pma_history";
// $cfg["Servers"][$i]["tracking"] = "pma_tracking";
// $cfg["Servers"][$i]["designer_coords"] = "pma_designer_coords";
/* Contrib / Swekey authentication */
// $cfg["Servers"][$i]["auth_swekey_config"] = "/etc/swekey-pma.conf";
/*
* End of servers configuration
*/
/*
* Directories for saving/loading files from server
*/
$cfg["UploadDir"] = "";
$cfg["SaveDir"] = ""; ?>


TAG:麥田守望客 |