MYSQL服务常见错误总结
系统环境信息
- CentOS release 6.3 (Final)
- VMware® Workstation 9.0.0 build-812388
MYSQL 服务安装方式
rpm安装包安装
常见错误1 :启动MYSQL 出现ERROR 2002 (HY000):
shell>mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 问题分析: 因为还没有启动mysql,当你启动mysql后,mysql.sock就会自动的生成
解决方法1
(采用如下启动方式)
#/usr/bin/mysqld_safe &
ctr+c
#mysql -uroot
Enter password:
mysql>
解决方法 2
查找MYSQL进程
shell>ps -ef|grep mysql
杀死进程
shell>kill -9 进程号
启动MYSQL
shell>/etc/init.d/mysqld start
Starting mysqld [OK]
常见错误2 :
启动MYSQL
查看日志 /var/log/mysqld.log
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
[ERROR]Fatalerror:Can'topenandlockprivilegetables:Table'mysql.host'doesn'texist
解决
#whereis mysql_install_db
mysql_install_db:/usr/bin/mysql_install_db
#cd /usr/bin/mysql_install_db
#scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
==================================================
显示信息如下
Installing MySQL system tables...
OK
Fillinghelptables...
OK
Tostartmysqldatboottimeyouhavetocopy
support-files/mysql.server to the right place for your system====================================================
再次启动MYSQL
#/etc/init.d/mysqld start
stating mysqld [OK]