Monday, May 7, 2012

Allowing MySQL Client to Connect to Remote MySQL server

I use MySQL Workbench with my old MySQL db server.  When I setup the new MySQL db instance for moodle 2.2, I lost that connection.  I could install MySQL workbench on the new server, but it would make sense to allow MySQL Workbench already installed to remote into MySQL. The question is:

How do I allow a remote ip address to connect to the MySQL moodle server?

I tried to connect from MySQL Workbench on my tower a few times, but would get the error message saying "The IP # needs permission to connect to the 'servername' instance.  I was already using one of the users from the mysql DB user table, I knew that was not the problem.  From the mysql server perspective, I had to grant access to the specific IP address trying to connect.

I searched around a bit and once I asked the correct question, found a couple posts that looked promising.
This post on the geekstuff and this post on stackoverflow.

What I ended up doing was opening the mysql db and then a query window and ran a variation of this command

GRANT ALL PRIVILEGES ON *.* TO username@'ip_address' IDENTIFIED BY PASSWORD 'user_password' WITH GRANT OPTION

Once this executed, I went to MySQL Workbench at the specified IP address and was able to connect to the DB. I tried to use the command line first, C:\wamp\bin\mysql\mysql5.5.20\bin\mysql.exe, but was not successful.Moral of the story? Do not duplicate software install, be patient and figure out how to get the existing software to play nice together.

No comments:

Post a Comment