Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trying to connect remotely to a MySQL server

Posted on 2016-10-07
10
Medium Priority
?
30 Views
Last Modified: 2016-10-15
Hi,

I'm running MySQL version 5.6.22 on a Win 2012 server and am trying to create a web interface which will allow me to manage users remotely.

I've got the PHP code working locally but am now trying to connect to this server remotely and running into problems. The Port is open from this server to our LAN address but when I try to connect using telnet I get the following error:

Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server.

So I thought I would dial it back a bit and test locally on the server.

So I'm now testing locally on the server and I can connect using:

mysql -h localhost -u administrator -p

but if I try:

mysql -h xxx.xxx.xxx.xxx -u administrator -p

It prompts to enter the password as usual but then gives me:

ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061)

I'm sure I have perms to connect from any host as I ran:

SELECT User,Host FROM mysql.user;

and got:

+---------------+-----------+
| User          | Host      |
+---------------+-----------+
| administrator | %         |
| root          | 127.0.0.1 |
| root          | ::1       |
| administrator | localhost |
| root          | localhost |
+---------------+-----------+

I've now come screeching to a halt in my knowledge of MySQL and could really do with some guidance please.

Thanks.
0
Comment
Question by:Letterpart
  • 5
  • 5
10 Comments
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41833542
Have you checked Windows Firewall on the 2012 server to ensure that port 3306 is open and allowing you through.
0
 
LVL 1

Author Comment

by:Letterpart
ID: 41833566
Sorry, yes.

The Windows Firewall is switched off for testing.
0
 
LVL 1

Author Comment

by:Letterpart
ID: 41833572
Just to add.

When i test it locally with

mysql -h xxx.xxx.xxx.xxx -u administrator -p

It prompts to enter the password as usual but then gives me:

ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061)

So it is def getting through to MySQL.
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41833661
Is the IP you are connecting to the server on the internal network address or external?
0
 
LVL 1

Author Comment

by:Letterpart
ID: 41833665
I'm testing this on the local machine to rule everything else out.
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41833772
So mysql -h localhost works?
0
 
LVL 1

Accepted Solution

by:
Letterpart earned 0 total points
ID: 41833784
Yes. as per above.

Now, I've just run the following command:

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'thepassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Open in new window


And am now able to connect using:

mysql -h xxx.xxx.xxx.xxx -u administrator -p on the local machine. So that's me one step closer. Now need to test connecting from a remote machine.
0
 
LVL 60

Assisted Solution

by:Julian Hansen
Julian Hansen earned 2000 total points
ID: 41833818
That should work now - sorry I thought I had already done a post regarding GRANT PRIVILEGES - but seems it did not go through.
0
 
LVL 1

Author Closing Comment

by:Letterpart
ID: 41844868
I resolved the issue myself but appreciate the time Julian put in to the question to help resolve it so would like to assign him points.
0
 
LVL 60

Expert Comment

by:Julian Hansen
ID: 41844879
Thank you and you are welcome.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question