cannot log into mysql locally
- by Lostsoul
When I try to log into mysql locally using the command:
mysql -u root -p
I get this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
I can access the server remotely(not as root) and my web pages are using the mysql fine, but locally I cannot log on(which I need because I need to create some users). Only change I made was to attach another drive to the server and move the sql data there. Here's my.cnf
[mysqld]
datadir=/media/ephemeral0/data/mysql
socket=/media/ephemeral0/data/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# adding more config
skip-external-locking
long_query_time=1
slow_query_log
slow_query_log_file=/var/log/log-slow-queries.log
log-bin=mysql-bin
server-id= 1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
myisam_recover_options
I read I need to edit the socket info in my.cnf to make sure it points to the right socket file..I double checked and the file exists(although it starts with an S when I do ls -l "srwxrwxrwx 1 mysql mysql 0 Jun 21 03:43 mysql.sock").
I'm not really sure how to resolve this. I have tried to reboot and ran yum update to make sure I was running the latest packages.
Please help!