红联Linux门户
Linux帮助

Linux Mysql无法启动/var/run/mysqld/mysqld.sock

发布时间:2015-12-09 10:08:28来源:linux网站作者:Rudon滨海渔村

冬天来了,今早mysql起不来了。

一直在叫嚷着:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'


发火,尝尽各种办法!都不行!为啥咧?!

最后忍无可忍之下,直接卸载了重装,搞定!

原数据也都在,幸好幸好!


以下是重装过程:

sudo apache2ctl stop 
sudo apt-get --purge remove mysql-client mysql-server mysql-common 
sudo apt-get autoremove 
sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install mysql-server mysql-client 
sudo apt-get install php5-mysql 
mysql -uroot -pxxxxxxx  
sudo apache2ctl start 


===== Log for Mysql at /var/log/mysql/error.log ====

151208  8:08:57 InnoDB: Initializing buffer pool, size = 128.0M 
151208  8:08:57 InnoDB: Completed initialization of buffer pool 
151208  8:08:57 InnoDB: highest supported file format is Barracuda. 
151208  8:09:04  InnoDB: Waiting for the background threads to start 
151208  8:09:05 InnoDB: 5.5.46 started; log sequence number 763296054 
151208  8:09:05 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208  8:09:05 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208  8:09:05 [Note] Server socket created on IP: '127.0.0.1'. 
151208  8:09:05 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208  8:09:06 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:09:06 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 
151208  8:09:06 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
151208  8:09:06 InnoDB: The InnoDB memory heap is disabled 
151208  8:09:06 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208  8:09:06 InnoDB: Compressed tables use zlib 1.2.8 
151208  8:09:06 InnoDB: Using Linux native AIO 
151208  8:09:06 InnoDB: Initializing buffer pool, size = 128.0M 
151208  8:09:06 InnoDB: Completed initialization of buffer pool 
151208  8:09:06 InnoDB: highest supported file format is Barracuda. 
151208  8:09:06  InnoDB: Waiting for the background threads to start 
151208  8:09:07 InnoDB: 5.5.46 started; log sequence number 763296054 
151208  8:09:07 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208  8:09:07 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208  8:09:07 [Note] Server socket created on IP: '127.0.0.1'. 
151208  8:09:07 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208  8:09:08 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:09:08 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 
151208  8:09:08 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
151208  8:09:08 InnoDB: The InnoDB memory heap is disabled 
151208  8:09:08 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208  8:09:08 InnoDB: Compressed tables use zlib 1.2.8 
151208  8:09:08 InnoDB: Using Linux native AIO 
151208  8:09:08 InnoDB: Initializing buffer pool, size = 128.0M 
151208  8:09:08 InnoDB: Completed initialization of buffer pool 
151208  8:09:08 InnoDB: highest supported file format is Barracuda. 
151208  8:09:08  InnoDB: Waiting for the background threads to start 
151208  8:09:09 InnoDB: 5.5.46 started; log sequence number 763296054 
151208  8:09:09 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208  8:09:09 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208  8:09:09 [Note] Server socket created on IP: '127.0.0.1'. 
151208  8:09:09 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208 08:13:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
151208  8:13:07 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:13:07 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.14.04.2) starting as process 3727 ... 
151208  8:13:07 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:13:07 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 
151208  8:13:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
151208  8:13:07 InnoDB: The InnoDB memory heap is disabled 
151208  8:13:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208  8:13:07 InnoDB: Compressed tables use zlib 1.2.8 
151208  8:13:07 InnoDB: Using Linux native AIO 
151208  8:13:07 InnoDB: Initializing buffer pool, size = 128.0M 
151208  8:13:07 InnoDB: Completed initialization of buffer pool 
151208  8:13:07 InnoDB: highest supported file format is Barracuda. 
151208  8:13:07  InnoDB: Waiting for the background threads to start 
151208  8:13:08 InnoDB: 5.5.46 started; log sequence number 763296054 
151208  8:13:08 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208  8:13:08 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208  8:13:08 [Note] Server socket created on IP: '127.0.0.1'. 
151208  8:13:08 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208 08:13:08 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
151208 08:48:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
151208  8:48:18 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:48:18 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.14.04.2) starting as process 4808 ... 
151208  8:48:18 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208  8:48:18 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 
151208  8:48:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
151208  8:48:18 InnoDB: The InnoDB memory heap is disabled 
151208  8:48:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208  8:48:18 InnoDB: Compressed tables use zlib 1.2.8 
151208  8:48:18 InnoDB: Using Linux native AIO 
151208  8:48:18 InnoDB: Initializing buffer pool, size = 128.0M 
151208  8:48:18 InnoDB: Completed initialization of buffer pool 
151208  8:48:18 InnoDB: highest supported file format is Barracuda. 
151208  8:48:18  InnoDB: Waiting for the background threads to start 
151208  8:48:19 InnoDB: 5.5.46 started; log sequence number 763296054 
151208  8:48:19 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208  8:48:19 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208  8:48:19 [Note] Server socket created on IP: '127.0.0.1'. 
151208  8:48:19 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208 08:48:19 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
151208 10:25:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
151208 10:25:41 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:25:41 [Note] /usr/sbin/mysqld (mysqld 5.5.46-0ubuntu0.14.04.2) starting as process 6652 ... 
151208 10:25:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:25:42 [Note] Plugin 'FEDERATED' is disabled. 
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist 
151208 10:25:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 
151208 10:25:42 InnoDB: The InnoDB memory heap is disabled 
151208 10:25:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:25:42 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:25:42 InnoDB: Using Linux native AIO 
151208 10:25:42 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:25:42 InnoDB: Completed initialization of buffer pool 
151208 10:25:42 InnoDB: highest supported file format is Barracuda. 
151208 10:25:43  InnoDB: Waiting for the background threads to start 
151208 10:25:44 InnoDB: 5.5.46 started; log sequence number 763296054 
151208 10:25:44 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208 10:25:44 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208 10:25:44 [Note] Server socket created on IP: '127.0.0.1'. 
151208 10:25:44 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 
151208 10:25:44 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 
151208 10:59:35 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:35 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:35 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:35 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:35 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:35 InnoDB: Using Linux native AIO 
151208 10:59:35 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:35 InnoDB: Completed initialization of buffer pool 
151208 10:59:35 InnoDB: highest supported file format is Barracuda. 
151208 10:59:37  InnoDB: Waiting for the background threads to start 
151208 10:59:38 InnoDB: 5.5.46 started; log sequence number 763296054 
151208 10:59:38  InnoDB: Starting shutdown... 
151208 10:59:39  InnoDB: Shutdown completed; log sequence number 763296054 
151208 10:59:39 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:39 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:39 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:39 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:39 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:39 InnoDB: Using Linux native AIO 
151208 10:59:39 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:39 InnoDB: Completed initialization of buffer pool 
151208 10:59:39 InnoDB: highest supported file format is Barracuda. 
151208 10:59:39  InnoDB: Waiting for the background threads to start 
151208 10:59:40 InnoDB: 5.5.46 started; log sequence number 763296054 
151208 10:59:40  InnoDB: Starting shutdown... 
151208 10:59:41  InnoDB: Shutdown completed; log sequence number 763296054 
151208 10:59:41 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:41 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:41 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:41 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:41 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:41 InnoDB: Using Linux native AIO 
151208 10:59:41 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:41 InnoDB: Completed initialization of buffer pool 
151208 10:59:41 InnoDB: highest supported file format is Barracuda. 
151208 10:59:41  InnoDB: Waiting for the background threads to start 
151208 10:59:42 InnoDB: 5.5.46 started; log sequence number 763296054 
ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1 
151208 10:59:42 [ERROR] Aborting 

151208 10:59:42  InnoDB: Starting shutdown... 
151208 10:59:43  InnoDB: Shutdown completed; log sequence number 763296054 
151208 10:59:43 [Note] /usr/sbin/mysqld: Shutdown complete 

151208 10:59:43 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:43 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:43 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:43 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:43 InnoDB: Using Linux native AIO 
151208 10:59:43 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:43 InnoDB: Completed initialization of buffer pool 
151208 10:59:43 InnoDB: highest supported file format is Barracuda. 
151208 10:59:43  InnoDB: Waiting for the background threads to start 
151208 10:59:44 InnoDB: 5.5.46 started; log sequence number 763296054 
151208 10:59:44  InnoDB: Starting shutdown... 
151208 10:59:45  InnoDB: Shutdown completed; log sequence number 763296054 
151208 10:59:45 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:45 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:45 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:45 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:45 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:45 InnoDB: Using Linux native AIO 
151208 10:59:45 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:45 InnoDB: Completed initialization of buffer pool 
151208 10:59:45 InnoDB: highest supported file format is Barracuda. 
151208 10:59:46  InnoDB: Waiting for the background threads to start 
151208 10:59:47 InnoDB: 5.5.46 started; log sequence number 763296054 
ERROR: 1050  Table 'plugin' already exists 
151208 10:59:47 [ERROR] Aborting 

151208 10:59:47  InnoDB: Starting shutdown... 
151208 10:59:47  InnoDB: Shutdown completed; log sequence number 763296054 
151208 10:59:47 [Note] /usr/sbin/mysqld: Shutdown complete 

151208 10:59:48 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead. 
151208 10:59:48 [Note] Plugin 'FEDERATED' is disabled. 
151208 10:59:48 InnoDB: The InnoDB memory heap is disabled 
151208 10:59:48 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
151208 10:59:48 InnoDB: Compressed tables use zlib 1.2.8 
151208 10:59:48 InnoDB: Using Linux native AIO 
151208 10:59:48 InnoDB: Initializing buffer pool, size = 128.0M 
151208 10:59:48 InnoDB: Completed initialization of buffer pool 
151208 10:59:48 InnoDB: highest supported file format is Barracuda. 
151208 10:59:48  InnoDB: Waiting for the background threads to start 
151208 10:59:49 InnoDB: 5.5.46 started; log sequence number 763296054 
151208 10:59:49 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 
151208 10:59:49 [Note]   - '127.0.0.1' resolves to '127.0.0.1'; 
151208 10:59:49 [Note] Server socket created on IP: '127.0.0.1'. 
151208 10:59:49 [Note] Event Scheduler: Loaded 0 events 
151208 10:59:49 [Note] /usr/sbin/mysqld: ready for connections. 
Version: '5.5.46-0ubuntu0.14.04.2'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)


Ubuntu下mysql无法重启:http://www.linuxdiyf.com/linux/14787.html

Linux下查看MySQL的安装路径:http://www.linuxdiyf.com/linux/14760.html

ubuntu15.04手动安装MySQL5.6.27数据库:http://www.linuxdiyf.com/linux/14699.html

Ununtu 15.04安装MySql(Django连接Mysql):http://www.linuxdiyf.com/linux/13783.html

Ubuntu15.04下MySQL5.6安装过程:http://www.linuxdiyf.com/linux/13250.html