MySQL Forums
Forum List  »  PHP

Re: Cannot connect to remote mysql.
Posted by: Roel Van de Paar
Date: September 21, 2016 09:02PM

Hi Tom,

Roel here. Thanks for the comment on https://www.percona.com/blog/2015/03/17/free-mysql-qa-and-bash-linux-training-series/ :)

I have to read into your question a bit to understand what is happening. Reading into what someone related may lead to errors, so tell me if something sounds off.

You say that localhost works. So I assume that either you are working on a server that has MySQL installed, or some home PC/your workstation.

I am also working on the basis that we want to take these steps in connecting;
1) localhost (works)
2) same host, but using the external IP
3) different host, using the external IP of the host used in 1 and 2.

If localhost works, but not the external IP of the same machine (i.e. if you have MySQL on a server and localhost connection works then the next test is to use the external IP address of that server from the same machine) then somehow there is a firewall/blocker in between which filters/denies that traffic.

IP rules can indeed be restricted to certain IP addresses (or blocks of addresses). You will have to be more detailed in your setup, including IP's (you can obfuscate them if you like) and firewalls etc. if you want to dig deeper together.

The next thing to do is to also check that your MySQL privileges are in place. You'll have to give an overview of the GRANT's you setup. And, what is the exact failure when you connect etc.

PS. Instead of a PHP script, you can simply use the mysql client binary that comes with every MySQL distribution in the bin directory. Use -h / -u / -P etc. options. This may also produce clearer error messages to look at.

God bless,
Roel

Options: ReplyQuote


Subject
Written By
Posted
September 21, 2016 07:48PM
Re: Cannot connect to remote mysql.
September 21, 2016 09:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.