简体   繁体   中英

Trying to connect to a remote host mysql with phpmyadmin via ssh

I'm trying to connect to a remote host(CentOS) mysql database from localhost(CentOS) with phpmyadmin via ssh.

In local config.inc.php I added:

$i++;
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['port'] = '3307';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['AllowNoPassword'] = FALSE;

Next I established the tunnel ssh -Ng -L 3307:127.0.0.1:3306 root@xx.xx.xx.xx It works fine through the command line:

mysql -P 3307 -h localhost -u root -p dbname

But when I try to access http://localhost:3307/phpmyadmin/ It says some gibberish: "5.5.20 J 5.5.20 p #p-.<'J} ÿ÷ € [0{=^@fa2tq^ mysql_native_password ! ÿ„#08S01Got packets out of order"

This is because there is no web server running on port 3307 . You need to access the correct URL for phpmyadmin, which is probably http://localhost/phpmyadmin/ and from there , select the correct server to connect to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM