Help - Search - Members - Calendar
Full Version: Connect to my MySQL server remotely?
The Planet Forums > Control Panels > Other
newguy
I have MySQL on my RHE server with CPanel and I would like to be able to connect to a database from some PHP code on another server.

Does anyone know how I would set this up? I tried just using the IP address of my server for the connection string, but to no avail.

Thanks!
Blue|Fusion
In cPanel, be sure to allow the Host to connecf (the IP of the server trying to connect to it). Once that is set it should work.
newguy
Thank you for the response. This is outside of my server question, but maybe you can help.

I did as you said, then went to my other server and created a test connect string. If I used either a domain name or ip address of my server, I got the following error:

I cannot connect to the database because: Access denied for user: 'myGuest@infong230.us.perfora.net' (Using password: YES)

It seems perfora.net is an alias for the host my friend is using.

Then, if I try to add a port onto the domain or IP, it gives me this error:

I cannot connect to the database because: Lost connection to MySQL server during query

I tried using ports 80, 21, and 3306.

Thanks for any ideas!
S3
By default, cpanel sets up users to only be allowed to login from localhost. If you want them to be able to login from another box, you need to change that privilege for that user. It's easy to do in WHM.

Go to WHM / MySQL / phpMyAdmin / privileges.

Find the user you want to be able to remotely connect and click 'edit'.

Scroll down near the bottom of the page and you should see that 'any host' is already showing in the menu choice.

Scroll the rest of the way down and click the bottom radio button "delete the old one from the user tables and reload the privileges afterwards", then click 'go' and you should be good.
newguy
That did it thanks!

Its very very slow, but I guess thats just the way it is when you are doing this over two servers instead of one. Thanks though
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.