2017-05-06 173 views
0

我試圖通過我的本地phpmyadmin安裝程序(從xampp安裝)訪問我的遠程mysql服務器。這裏是我的phpmyadmin config.inc.php文件:我無法通過本地phpmyadmin訪問遠程mysql服務器

/* Authentication type and info */ 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['user'] = 'remote-mysql-server-username'; 
$cfg['Servers'][$i]['password'] = 'remote-mysql-server-pass'; 
$cfg['Servers'][$i]['extension'] = 'mysqli'; 
$cfg['Servers'][$i]['AllowNoPassword'] = true; 

// remote mysql server 
$cfg['Servers'][$i]['verbose']  = 'remote mysql server'; 
$cfg['Servers'][$i]['host']   = 'some_website.com/'; 
$cfg['Servers'][$i]['port']   = '3306'; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['compress']  = FALSE; 

我得到這個錯誤:

hpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server. 
+0

明顯的問題是服務器,端口和密碼等是否正確。那麼你能否驗證phpmyadmin以外的數據庫連接(比如說'ncat')? – KevinO

+0

是的,他們是正確的,因爲我通過網絡應用程序和SSH連接到我的mysql服務器.. – Dave2345

回答

0

要連接必須配置遠程MySQL服務器允許或採取其他請求比本地主機。 檢查防火牆允許端口3306(傳入和傳出)。

現在我們將局勢升級:

1)在MySQL配置的my.ini首先檢查了「綁定地址」指令應該是0.0.0.0,允許來自任何IP地址的連接。 2)用戶應該對我們正在訪問的數據庫擁有全部權限。

3)第三使本地主機方案phpMyAdmin的工作,你的phpMyAdmin的配置文件年底前>(標籤)補充一點:?

/* Remote Server */ 
$i++; 
$cfg['Servers'][$i]['connect_type'] = 'tcp'; 
$cfg['Servers'][$i]['auth_type'] = 'config'; 
$cfg['Servers'][$i]['host'] = 'myinstance.us-1.rds.amazonaws.com';//this is example enter your address 
$cfg['Servers'][$i]['verbose'] = 'Remote Server Name'; 
$cfg['Servers'][$i]['user'] = '**********'; 
$cfg['Servers'][$i]['password'] = '**********'; 

立即登錄在本地主機和從當前服務器下拉菜單中選擇放下你的服務器名稱,phpmyadmin將完成剩下的任務。

希望這會幫助你。

+0

是的,它是端口3306.我是一個亞馬遜linux ec2服務,並在控制檯中檢查 – Dave2345

+0

確定編輯答案請檢查 – CoderSam