MYSQL错误汇总

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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  可能是丢失库文件或库文件的链接文件丢失
[[email protected] mysql]# mysql
mysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
[[email protected] mysql]# service mysqld start
/usr/bin/mysqladmin: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
Cannot 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

[[email protected] mysql]# tail /var/log/mysqld.log
160912 10:54:29 [ERROR] Fatal error: Cant open and lock privilege tables: Table mysql.host doesnt exist
160912 10:54:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
160912 10:54:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Table mysql.plugin doesnt exist
160912 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.0M
160912 10:54:43  InnoDB: Completed initialization of buffer pool
160912 10:54:43  InnoDB: Started; log sequence number 0 44233
160912 10:54:43 [ERROR] Fatal error: Cant open and lock privilege tables: Table mysql.host doesnt exist
160912 10:54:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

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

mysql_install_db

[[email protected] mysql]# mysql_install_db 
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE 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-password

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly 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.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please 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错误汇总的主要内容,如果未能解决你的问题,请参考以下文章

连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段

从mysql的片段中加载ListView

MYSQL错误汇总

mysql 错误汇总

MySQL问题汇总

Linux错误汇总