PhpMyAdmin Port Forward Does Not Work

Asked 2 years ago, Updated 2 years ago, 67 views

phpMyAdmin Port Forward Does Not Work

I am trying to connect to the database mysql server (192.168.2.42) from another machine (192.168.2.44).
So I set up the port forward.

 ssh-f-N-C-L 10000:127.0.0.1:3306 [email protected]

Now I can access phpMyAdmin on another machine and check the DB schema of mysql on the DB server.

However, after killing the port forward configuration process, you are still able to connect to the DB server.

After phpMyAdmin deployment, config.inc.php is described below.

$cfg['Servers'][$i]['host']='192.168.2.42';

$cfg['Server'][$i]['port']='10000';

Does this mean that you have just gone to connect to the 3306 default port on the mysql server?

Please let me know where to review.

php phpmyadmin

2022-09-30 21:13

1 Answers

$cfg['Servers'][$i]['host']='192.168.2.42';
$cfg['Server'][$i]['port']='10000';

I'm not sure about the phpMyAdmin configuration, but because the latter is Server instead of Servers, the default port 3306 is being used and connected to 192.168.2.42:3306 regardless of SSH.

There are a lot of things wrong with the previous part, so I recommend you to review the design from scratch.

I am trying to connect to the database mysql server (192.168.2.42) from another machine (192.168.2.44).
So I set up the port forward.

 ssh-f-N-C-L 10000:127.0.0.1:3306 [email protected]

For this ssh connection, 127.0.0.1:10000 on the MySQL server side is forwarded to 127.0.0.1:3306 on the phpMyAdmin machine side (because -g is not specified, 192.168.2.42:10000 is not open)

On the other hand, the phpMyAdmin configuration appears to be trying to connect to 192.168.2.42:10000.In this case, 192.168.2.44 → 192.168.2.42:10000 does not pass through the SSH tunnel.

 192.168.2.42 (MySQL) 192.168.2.44 (phpMyAdmin)
---------------------  (SSH) -----------------------------
|                    |------------>|
|    127.0.0.1—10000-+============+-->127.0.0.1:3306
|                    |------------>|
|                    |            |
| (192.168.2.42:10000) | <------------ | (phpMyAdmin)
  今 It's not open with the current setting.

Is MySQL over SSH really something you want to do?If your network is untrusted, MySQL is native and supports SSL connections, so you should consider this.


2022-09-30 21:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.