Setting up a remote connection to a MYSQL database on Plesk 10

A new project’s required me to have access to a MYSQL database from a REMOTE IP address.

There are conflicting information about this, so in order to get the thing done correctly, here’s a reminder of the various steps:

1.Check /etc/my.cnf, normally the file’s already correct (Since Plesk 8), Reference here

2. open mysql shell session with:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql 

3. add credential to allow remote IP to connect to specific database:

GRANT ALL ON foo.* TO bar@'192.168.0.1' IDENTIFIED BY 'PASSWORD';

REVOKE GRANT OPTION ON foo.* FROM bar@'192.168.0.1';

where:

  • “foo” is the database name
  • “bar” is the database user name
  • “192.168.0.1” is the remote IP address
  • “PASSWORD” is the password, a random value (NOT PASSWORD!)

4. Open the Mysql port( 3306) on the Plesk Firewall (in the Modules section)

5. Test the connection using:

telnet host 3306

where:

  • “host” is the Plesk server  to access.

A connection should then be able to be made.

2 thoughts on “Setting up a remote connection to a MYSQL database on Plesk 10”

  1. What should we get as a result when we try to connect with telnet.

    Here’s what putty shows me before telling me that the connection is closed be the remote host.

    4
    5.1.69ìeq&fSK_oot packets out of order

    I’m trying to figure out why my php app from one server can’t talk to it’s associated database on another server… Thanks for any information that could lead me somewhere near a solution 😉

    1. Given that an ssh call returns this on port 22:

      telnet server.com 22
      Trying 111.222.333.444…
      Connected to server.com.
      Escape character is ‘^]’.
      SSH-2.0-OpenSSH_5.3

      one can think you should get something like MYSQL{something} instead of SSH-2.0-OpenSSH_5.3

Comments are closed.