phpMyAdmin的安裝及排錯

科技小先鋒發表於2017-11-16
phpMyAdmin的安裝及排錯
 
環境:redhat9,php5.04,mysql5.0.16,phpMyAdminphpMyAdmin-v2.10.1
將下載下來的壓縮檔案加壓到apache的網頁存放路徑
然後複製配置檔案
cp libraries/config.default.php config.inc.php
 
修改配置檔案
vi config.inc.php
 
$cfg[`Servers`][$i][`host`]          = `192.168.0.111`
//mysql伺服器的名稱或ip,本機的話可以寫成localohost
$cfg[`Servers`][$i][`socket`]        = “;  
//知道路徑的話可以寫成如/tmp/mysql.sock(mysqlsock所在路徑
$cfg[`Servers`][$i][`user`]          = `root`;
//mysql的帳號
$cfg[`Servers`][$i][`password`]      = `bit`;
//mysql帳號的密碼
 
排錯
#2002 – 伺服器沒有響應 (or the local MySQL server`s socket is not correctly configured)
host值改為localhost或者127.0.0.1或者是真實IP,如我寫的192.168.0.111
socket的值寫成具體路徑的sock,/tmp/mysql.sock
 
MySQL said:
#1045 – Access denied for user `root`@`192.168.0.111` (using password: NO)
說明password不正確
 
 
在頁面的最下面顯示
The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.
或者對應的中文
沒有發現 PHP 的擴充套件設定mbstring 而當前系統好像在使用寬字符集。沒有 mbstring 擴充套件的 phpMyAdmin 不能正確識別字串,可能產生不可意料的結果.
這是因為我們在裝PHP的時候沒有把mbstring模組加上。
win下很簡單啦,只要到配置檔案裡把mbstring.dll前面的分號去掉,並把檔案放到相應的地方就可以了,在linux下就不同了,但是也很簡單。只要在編譯PHP的時候加上引數
–with-mbstring –enable-mbstring=all
就可以了。
 
可以先用這個例程試驗 a.php
<?php
   $DbHost = “192.168.0.111”; //mysql伺服器地址
   $DbUser = “root”; //mysql帳號
   $DbPass = “bit”;      /*mysql密碼*/
   $DbName = “mysql”;
 //資料庫名稱,這裡是名為mysql的資料庫,其實只是以這個資料庫為例,其他資料庫名也一樣
   $DbConnect = mysql_connect( $DbHost, $DbUser, $DbPass); //連上mysql
   mysql_select_db( $DbName, $DbConnect); //開啟名為mysql資料庫
   mysql_close( $DbConnect); //關閉資料庫連線,可以看到我們並沒有對資料庫做任何操作,只是開啟關閉而已
   echo “success”;//輸出一個字串
?>
訪問a.php這個頁面正常的話會顯示success
雖是原創,但也參考了網上很多文章,包括copy,不過所有過程我都親自測試通過.

本文轉自yahoon 51CTO部落格,原文連結:http://blog.51cto.com/yahoon/31252,如需轉載請自行聯絡原作者


相關文章