1. ERROR 2002 (HY000):Can’t connect to local MySQL server
A: most because mysql installation way is to use the RPM, automatically looking for/var/lib/mysql/mysql. This document the sock, and mysql. The sock this file should be created at the time of initialization, so when start the service for the first time this thing.
[mysql] [client] socket = / TMP /mysql.sock /var/lib/mysql/ Mysql -h127.0.0.1 -uuser -ppassword = / TMP/mysql.sock = / TMP / Is # ln -s/TMP/mysql. The sock/var/lib/mysql/mysql. The sock
Sock file is unavailable. Run the service mysqld start command
Error 1045 (28000): Access denied for user’root’@’localhost’?
Answer: need to change password!
# /etc/init.d/mysql stop
# mysqld_safe –user=mysql–skip-grant-tables –skip-networking &
# mysql -u root mysql
mysql> UPDATE user SETPassword=PASSWORD(‘newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql –u root –p
Enter password:
mysql>
\