• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Can't connect to MySQL

Sheratan

Well-known member
#1
I can't connect to mysql using
Code:
mysql -u root -p
But I can login into phpmyadmin and my forum are running without problem! o_O

Code:
[mysql]

# CLIENT #
port                           = 3306
socket                         = /var/lib/mysql/mysql.sock

[mysqld]

# GENERAL #
user                           = mysql
default_storage_engine         = InnoDB
pid_file                       = /var/lib/mysql/mysql.pid
....
It's Percona 5.6 in Debian 7.

Any thought?
 

Tracy Perry

Well-known member
#6
First thing.. check your disk space. How much free space do you have.
Second, try logging in with mysql -u root -p -h 127.0.0.1 and see if it works.
Third, make sure the /var/lib/mysql/mysql.sock exists and restart the msyql server and try again.
 

Tracy Perry

Well-known member
#8
Indicates problems communicating with the socket itself. Did you check to see if it exists at the location you specified in your my.cnf?
By using the localhost IP you are bypassing the socket entirely.

This is what I have defined in mine
Code:
[client]
socket          = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
Make sure the socket is defined for client, mysqld and mysqld_safe. I'm running the latest Percona on Debian Wheezy on all my servers and I have the above in their my.cnf.