LINUX上安装MYSQL5.1
linux version:
Linux version 2.6.18-6-xen-vserver-686 (Debian 2.6.18.dfsg.1-24) (dannf@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Sat Dec 27 13:50:55 UTC 2008
MYSQL version
mysql-5.1.33-linux-i686-glibc23.tar.gz
安装成功。
执行service mysqld restart
Shutting down MySQL..
Starting MySQL......
debian:/usr/local#
成功。
debian:/var/run/mysqld# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
debian:/var/run/mysqld# chown -R mysql /var/run/mysqld/
苦思不得其解。查看my.cnf,截取部分如下
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
那么问题肯定出在socket这里了。这里对应的是/tmp/目录,查看/tmp/目录下面,有mysql.sock。尝试/tmp下用ln创建软连接mysqld.sock到/var/run/mysql/mysqld.sock.restart service ,无果。于是尝试在/var/run/mysql/创建软连接到/tmp/mysql.sock。restart service 也无果。google了一下。发现很多类似情况,照搬过来,It does not work too.看来还是回到开始,问题肯定是处在socket上,更改my.cnf里的socket路径为/var/run/mysql/mysqld.sock,直接在改路径下创建一个mysqld.sock。重启mysql。成功了