下午运行mysql命令,报错:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
mysql服务器没有启动。
查看系统日志文件 /var/log/syslog:
Sep 2 16:42:20 learne-desktop mysqld_safe[7334]: started
667 Sep 2 16:42:20 learne-desktop mysqld[7337]: 090902 16:42:20 InnoDB: Started; log sequence number 0 73284
668 Sep 2 16:42:20 learne-desktop mysqld[7337]: 090902 16:42:20 [ERROR] Fatal error: Can't open and lock privilege tables: T able 'mysql.host' doesn't exist
669 Sep 2 16:42:20 learne-desktop mysqld_safe[7349]: ended
670 Sep 2 16:42:34 learne-desktop /etc/init.d/mysql[7499]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/m ysql/debian.cnf ping' resulted in
671 Sep 2 16:42:34 learne-desktop /etc/init.d/mysql[7499]: ^G/usr/bin/mysqladmin: connect to server at 'localhost' failed
672 Sep 2 16:42:34 learne-desktop /etc/init.d/mysql[7499]: error: 'Can't connect to local MySQL server through socket '/var/ run/mysqld/mysqld.sock' (2)'
673 Sep 2 16:42:34 learne-desktop /etc/init.d/mysql[7499]: Check that mysqld is running and that the socket: '/var/run/mysql d/mysqld.sock' exists!
大概就是一些系统启动时必须的表被破坏了吧!
解决方法:
1. cd /usr/bin/
2. sudo ./mysql_install_db
纠结了一下午!