[ubuntu-za] Can't connect to local MySQL server
Alf Stockton
alf at stockton.co.za
Wed Jan 28 11:17:56 GMT 2009
Walter Leibbrandt wrote:
> Hi,
>
> Alf Stockton wrote:
>> I get :-
>> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
>> '/var/lib/mysql/mysql.sock' (111)
>> when I attempt to mysql -u root -p
>>
>> even though the user and password is correct and
>> root at general:~# ls -al /tmp/mysql.sock
>> lrwxrwxrwx 1 root root 25 2009-01-28 10:18 /tmp/mysql.sock ->
>> /var/lib/mysql/mysql.sock
>> root at general:~# ls -al /var/lib/mysql/mysql.sock
>> -rw-r--r-- 1 root root 0 2009-01-28 11:40 /var/lib/mysql/mysql.sock
>>
>> please tell me what I need to fix
> 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....:-(
--
Regards,
Alf Stockton www.stockton.co.za
When angry, count four; when very angry, swear.
-- Mark Twain, "Pudd'nhead Wilson's Calendar"
More information about the ubuntu-za
mailing list