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

Alf Stockton alf at stockton.co.za
Wed Jan 28 12:15:43 GMT 2009


Frank Kusel wrote:
> Walter Leibbrandt wrote:
>> 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.
>>
>>   
> You didn't maybe change users, passwords or anything like that?
> 
No I did not.

-- 
Regards,
Alf Stockton		www.stockton.co.za

You will have good luck and overcome many hardships.



More information about the ubuntu-za mailing list