1. 程式人生 > >mysql 啟動失敗

mysql 啟動失敗

ready max tst 進一步 select tab apn ges read

一、報錯信息如下:

MySQL啟動報錯“Bind on TCP/IP port: Address already in use”

分析原因:端口3306 被占用

ps -aux | grep mysql

發現3306 並沒有被使用

使用命令:

netstat -apn|grep 3306

# netstat -apn | grep 3306
tcp 0 0 ::ffff:192.168.65.211:3306 ::ffff:192.168.65.211:3306 ESTABLISHED 18148/java

發現3306端口被PID為18148的Java進程占用。

進一步使用命令:ps -aux | grep java,或者直接:ps -aux | grep pid 查看
就可以明確知道3306端口是被哪個程序占用了!然後判斷是否使用KILL命令幹掉!

啟動mysql ,服務正常

二、mysql登錄:使用密碼無法登錄,不使用密碼可以登錄

select * from mysql.user where user=‘‘;


+-----------+------+----------+-------------+-------------+-------------+-------------+----------------+-----------+------------+-----------------+------------+------------+--------------+----------------+-----------------+------------------+------------------+----------------+--------------------+--------------+----------+------------+-------------+--------------+---------------+-----
| Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_pr_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Supercute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routit_priv | Trigger_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_
+-----------+------+----------+-------------+-------------+-------------+-------------+----------------+-----------+------------+-----------------+------------+------------+--------------+----------------+-----------------+------------------+------------------+----------------+--------------------+--------------+----------+------------+-------------+--------------+---------------+-----
| localhost | | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 |
| hadoop01 | | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 |
+-----------+------+----------+-------------+-------------+-------------+-------------+----------------+-----------+------------+-----------------+------------+------------+--------------+----------------+-----------------+------------------+------------------+----------------+--------------------+--------------+----------+------------+-------------+--------------+---------------+-----
2 、rows in set (0.00 sec)
---------------------
查詢有結果,然後進行下一步。
use mysql;
delete from user where user = ‘‘;

3、刪除了多余的空白賬戶, 然後進行下一步。
flush privileges;-

4、重載一次權限表,最後用
service mysqld restart

5、重啟mysql服務,問題得到解決

mysql 啟動失敗