mysql:作业启动失败。缺少 mysqld.sock

mysql:作业启动失败。缺少 mysqld.sock

我该如何修复此问题并启动 mysql-server?

在 /etc/init.d/mysql start 或 service mysql start 之后我收到消息 start: “Job failed to start” 在 # mysqld 之后我收到此消息:

mysqld
121123 11:33:33 [ERROR] Can't find messagefile '/usr/share/mysql/errmsg.sys'
121123 11:33:33 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Unknown error 1146
121123 11:33:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
121123 11:33:33 InnoDB: The InnoDB memory heap is disabled
121123 11:33:33 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121123 11:33:33 InnoDB: Compressed tables use zlib 1.2.3.4
121123 11:33:33 InnoDB: Initializing buffer pool, size = 128.0M
121123 11:33:33 InnoDB: Completed initialization of buffer pool
121123 11:33:33 InnoDB: highest supported file format is Barracuda.
121123 11:33:33  InnoDB: Waiting for the background threads to start
121123 11:33:34 InnoDB: 1.1.8 started; log sequence number 1595675
121123 11:33:34 [ERROR] Aborting
121123 11:33:34  InnoDB: Starting shutdown...
121123 11:33:35  InnoDB: Shutdown completed; log sequence number 1595675
121123 11:33:35 [Note]

我尝试按照 mysql 的要求去做:

mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' 
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

是的,/var/run/mysql 是空的:

mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' 
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

这是我的文件 /etc/mysql/my.cnf

# cat /etc/mysql/my.cnf |grep sock
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
socket      = /var/run/mysqld/mysqld.sock
socket      = /var/run/mysqld/mysqld.sock
socket      = /var/run/mysqld/mysqld.sock

然后我尝试从 cero 重新安装 mysql:

  apt-get purge mysql-client mysql-common mysql-server
  rm -R /var/lib/mysql
  rm -R /etc/mysql
  rm -R /var/run/mysqld
  userdel mysql
  apt-get install mysql-server mysql-client

然后,输入 mysql 的 root 密码后出现此错误:

 | Unable to set password for the MySQL "root" user                              │  
 │                                                                               │  
 │ An error occurred while setting the password for the MySQL administrative     │  
 │ user. This may have happened because the account already has a password, or   │  
 │ because of a communication problem with the MySQL server.                     │  
 │                                                                               │  
 │ You should check the account's password after the package installation.       │  
 │                                                                               │  
 │ Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more   │  
 │ information.

并且我再次无法启动 mysql 并收到相同的消息。

答案1

您可能遇到了 MySQL 的循环依赖,无法启动并运行 Debian 配置脚本,尝试修复需要运行 MySQL 的问题。

尝试使用以下命令重新初始化数据目录mysql_install_db

答案2

首先,你的 my.cnf 中不应该有 3 个套接字文件

请尝试以下操作:

dpkg-reconfigure mysql-server

系统将要求您为 root 用户设置密码。祝您好运

相关内容