[ubuntu-za] Can't connect to local MySQL server

Walter Leibbrandt walter+ubuntuza at translate.org.za
Wed Jan 28 11:27:39 GMT 2009


Alf Stockton wrote:
> Walter Leibbrandt wrote:
>   
>> Hi,
>>
>>     
>> If `netstat -tnlp | awk '$4 ~ /3306$/'` doesn't give any output, I'd 
>> wager that it didn't start up successfully. If it does, try and connect 
>> to the IP on which it listens (the part before 3306) by using the -h 
>> option to the MySQL command-line client.
>>     
> root at general:~# netstat -tnlp | awk '$4 ~ /3306$/'
> tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN 
>    23369/mysqld
>
> and
>
> root at general:~# mysql -h localhost -u root -p
> Enter password:
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
> '/var/lib/mysql/mysql.sock' (111)
>
> and
>
> root at general:~# mysql -h 127.0.0.1 -u root -p
> Enter password:
> ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: 
> YES)
>
>   
>> If that helped, check the "bind-address" config option in the "mysqld" 
>> section in /etc/mysql/my.cnf. In my (limited) experience it tends to 
>> have rather paranoid defaults.
>>     
> the bind-address is to 127.0.0.1 not to localhost....:-(
>   
Grarg. Just try setting the bind-address to 0.0.0.0. If you still get 
the same error ("Access denied for user..."), the problem is probably 
related to your MySQL root user.

-- 
Walter Leibbrandt                  http://translate.org.za/blogs/walter
Software Developer                                  +27 12 460 1095 (w)
Translate.org.za

Recent blogs:
* Virtaal's MVCisation
http://www.translate.org.za/blogs/walter/en/content/virtaals-mvcisation
* Things that changed the way I code
* Switching from Subversion to git





More information about the ubuntu-za mailing list