首页 > 代码库 > 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: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t 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‘ doesn‘t exist160912 10:54:43 [ERROR] Can‘t 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: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t 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-password‘Alternatively 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
http://www.cnblogs.com/ylqmf/archive/2011/10/17/2215726.html
MYSQL错误汇总
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。