Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can log in at the command line - mysql -uroot -p** (my password is replaced by *'s) but when I try those credentials in the mySQL administrator gui I get `Could not connect to host 'castleLinux2011'. MySQL Error Nr. 2003 Can't connect to MySQL server on 'castleLinux2011' (111)

I am doing this locally on my own personal machine. Using port 3306 Using my local machine name

share|improve this question

migrated from stackoverflow.com Sep 11 '11 at 19:26

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers

up vote 2 down vote accepted

I have no idea if you are trying to connect to a remote MySQL server or one running locally on your machine. Information like that is helpful! So, here's the rundown on how to achieve either working correctly:

If you are running the MySQL server locally (meaning the machine you are using MySQL administrator on is the same one that is running the server), you want to put "127.0.0.1" into the server host field. The default port that MySQL uses is 3306 - so unless you have changed that, it should work.

If you are running the MySQL server remotely (meaning the machine you are using MySQL administrator on is NOT the same one that is running the server), you want to put the IP of the host machine into the server host field. You will have to log in at the command line like you would normally and use the following commands:

mysql> update db set Host='your_ip' where Db='your_db_name';
mysql> update user set Host='your_ip' where user='your_user_name';

You should replace 'your_ip' with your MySQL administrator machine's IP (like '203.56.81.167') and do the same with your database name and username. This allows sets up the permission for remote connecting securely. You would need to repeat this for all machines and users that would be connecting remotely.

Aside from that, you may also have to expose port 3306 on the host machine's router, firewall, etc. Post another question if you need help with that and provide information about operating system, firewall software, and router manufacturer.

share|improve this answer
    
Thanks Mitch! I'll start by updating the q with some of that. –  Michael Durrant Sep 11 '11 at 12:03
    
YES! 127.0.0.1 fixed it. I had been using my actual machine name. Didn't think 127.0.0.1 would work for a non-web product but it did! Thanks! Answer accepted. –  Michael Durrant Sep 11 '11 at 12:07
add comment

Seems like the GUI should be connecting to localhost not castleLinux2011

share|improve this answer
    
yes that was it –  Michael Durrant Sep 11 '11 at 12:08
add comment

There are some very good suggestions at Causes of Access-Denied Errors, and I'd be having a close look at the first three suggestions (port types, startup networking config and firewall). Otherwise, check that your GRANT rules for the root user do indeed permit connections from locations other than localhost. You might also find this question and its answers illuminating

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.