首页 > 代码库 > MYSQL错误汇总

MYSQL错误汇总

问题描述:启动MySQL提示: Another MySQL daemon already running with the same unix socket

解决方法:

            启动或重启mysql不成功,提示:Another MySQL daemon already running with the same unix socket

出现此问题往往是上次mysql意外关闭造成的.最简便的解决方法就是找到mysql.sock文件删除掉,再重新启动mysqld即可成功.
查找
updatedb
locate mysql.sock
 
 
完全卸载MYSQL
 
01、检测MySQL存在与否
rpm -qa | grep mysql
技术分享
2、关闭MySQL服务
ss -ln | grep 3306  #查看是否开启MySQL
/etc/init.d/mysqld stop   或  service mysqld stop
3、查看安装文件目录
卸载RPM
yum remove mysql mysql-server mysql-libs
find / -name mysql
rm -rf   xxx
04、删除mysql用户
userdel -r mysql
 
 
问题描述:缺少这个共享库 libmysqlclient.so.16  可能是丢失库文件或库文件的链接文件丢失
[root@upday mysql]# mysqlmysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory[root@upday mysql]# service mysqld start/usr/bin/mysqladmin: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directoryCannot check for MySQL Daemon startup because of mysqladmin failure.Starting mysqld:                                           [FAILED]

 解决方法:

yum remove mysql-libs   #卸载

yum install -y mysql-libs   #在安装

 

问题描述:丢失mysql.hosts文件

问题解决:

查看日志

cat /etc/my.cnf  #查看日志存放的位置

tail  /var/log/mysqld.log

[root@upday mysql]# tail /var/log/mysqld.log160912 10:54:29 [ERROR] Fatal error: Cant open and lock privilege tables: Table mysql.host doesnt exist160912 10:54:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended160912 10:54:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql/usr/libexec/mysqld: Table mysql.plugin doesnt exist160912 10:54:43 [ERROR] Cant open the mysql.plugin table. Please run mysql_upgrade to create it.160912 10:54:43  InnoDB: Initializing buffer pool, size = 8.0M160912 10:54:43  InnoDB: Completed initialization of buffer pool160912 10:54:43  InnoDB: Started; log sequence number 0 44233160912 10:54:43 [ERROR] Fatal error: Cant open and lock privilege tables: Table mysql.host doesnt exist160912 10:54:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

从日志中看出需要初始化数据库

mysql_install_db

[root@upday mysql]# mysql_install_db Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password new-password/usr/bin/mysqladmin -u root -h upday password new-passwordAlternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /usr ; /usr/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script!

设置MySQL密码
mysqladmin  -u root  password ‘123123‘

登录MySQL

mysql -u root -p

 曾经的回忆

技术分享

引用
http://www.cnblogs.com/kerrycode/p/4364465.html
http://www.cnblogs.com/ayanmw/p/3434028.html
http://www.cnblogs.com/ylqmf/archive/2011/10/17/2215726.html
 



MYSQL错误汇总