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'm trying to connect to my local MySQL server with MySQL Workbench. When I do so, I get a "Can't connect to MySQL server..." error. I can connect just fine if I SSH into the machine and start up MySQL there, so I know it's not an issue there.

Is there something special I need to do to tell my MySQL server that "outsiders" can connect to it?

share|improve this question
add comment

3 Answers

Make sure that

  • mysqld is not running with --skip-networking

  • or --bind-address = 127.0.0.1

Also make sure you have allowed your client end access to port 3306(by default) on the server and it is not firewalled.

There is more information and all you need to know on this page in the MySQL documentation.

share|improve this answer
    
Thanks, Richard. My solution turned out to be something a little different but your answer put me on the right track. –  Jason Swett Sep 28 '10 at 13:08
    
Jason: Glad you got sorted. I forgot to mention the user@%. D'oh. Never mind you got there in the end. –  Richard Holloway Sep 29 '10 at 16:10
add comment

yes you do - MySQL authentication is done on a username and host basis.

The best bet is to create an admin user that can auth from any host (% wildcard).

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

share|improve this answer
    
I did that. Apparently something more needs to be done because that didn't take care of it. (I made sure I could log in with my new user locally before trying it remotely.) –  Jason Swett Sep 28 '10 at 12:57
add comment
up vote 0 down vote accepted

I found the following in /etc/mysql/my.cnf:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address   = 127.0.0.1

To solve my problem, I did two things:

  1. I created a new user: 'admin'@'%'
  2. I commented out the "bind-address" line in my.cnf.

Now it works.

share|improve this answer
    
Note: you must restart MySQL after this in order for the change to take effect. –  Jason Swett Oct 11 '10 at 14:36
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.