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]# mysql
mysql: 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 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

[root@upday mysql]# tail /var/log/mysqld.log
160912 10:54:29 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't 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' doesn't exist
160912 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.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: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
160912 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...
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
 




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM