编辑:查看选中的答案评论以解决您的问题。
每当我尝试启动 SQLD 服务时,我都会收到 MySQL Daemon Failed to Start。我实际上尝试通过执行以下操作来“启动”服务:
service mysqld start
还
当我输入:mysql
我得到:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
我知道那个目录下应该有一个 mysql.sock 文件,所以我创建了一个。但是该文件只是自动删除了它自己,我继续收到错误 2002。
由于错误,我也无法登录 PHPMyAdmin。我可以访问 phpmyadmin 页面,但登录时我得到: #2002 Cannot log in to the MySQL server
编辑:
这是我的 mysql.log 文件:
131201 13:05:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
131201 13:18:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131201 13:18:18 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
131201 13:18:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
131201 13:18:18 InnoDB: The InnoDB memory heap is disabled
131201 13:18:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131201 13:18:18 InnoDB: Compressed tables use zlib 1.2.3
131201 13:18:18 InnoDB: Using Linux native AIO
131201 13:18:18 InnoDB: Initializing buffer pool, size = 128.0M
131201 13:18:18 InnoDB: Completed initialization of buffer pool
131201 13:18:18 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
131201 13:18:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
我跑了 mysql_upgrade 并得到了
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
原文由 Travis 发布,翻译遵循 CC BY-SA 4.0 许可协议
此错误的最可能原因是您的 mysql 服务器未运行。当您输入
mysql
时,您正在执行 mysql 客户端。尝试:
更新(在 OP 包括登录问题后;取自以下评论):