尝试启动我的 mysql 服务。
/etc/init.d/mysql start
返回:
Job failed. See system logs and 'systemctl status' for details.
更远:
systemctl status mysql.service
返回:
mysql.service - LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: failed since Mon, 04 Aug 2014 16:20:43 -0400; 38s ago
Process: 14148 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 16457 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/mysql.service
我有什么想法可以了解发生了什么吗?
最新条目/var/log/mysql/mysqld.log
:
140805 08:52:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140805 8:52:42 [ERROR] mysqld: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
140805 8:53:13 [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_contr$
140805 8:53:13 [ERROR] Plugin 'Aria' init function returned error.
140805 8:53:13 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
140805 8:53:13 [ERROR] Failed to initialize plugins.
140805 8:53:13 [ERROR] Aborting
140805 8:53:13 [Note] /usr/sbin/mysqld: Shutdown complete
140805 08:53:13 mysqld_safe mysqld from pid file /var/run/mysql/mysqld.pid ended
答案1
该/var/lib/mysql/aria_log_control
文件被另一个进程打开,因此mysqld
无法启动。
检查当前谁/什么打开了文件:
lsof `/var/lib/mysql/aria_log_control`
它应该列出打开它的进程。
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 1506 mysql 10uW REG 253,1 52 263948 /var/lib/mysql/aria_log_control
如果该进程绝对不应该运行,请使用以下命令将其关闭:
sudo kill -SIGTERM <PID>
如果失败:
sudo kill -SIGKILL <PID>
或者重新启动。
答案2
转到您的/etc/my.cnf
文件,然后检查datadir
和tmpdir
变量。转到这些目录,并检查其中文件的权限。如果 拥有任何文件root
,请将权限更改为类似的内容mysql:mysql
,然后重试。
例子:
在/etc/my.cnf
你发现:
datadir = /var/lib/mysql
请尝试以下操作,然后再次尝试启动 mysql:
chown mysql:mysql /var/lib/mysql
答案3
问题出mysql_install_db
在包mariadb-server-5.5.34-2.fc20
和community-mysql-server-5.5.35-1.fc20
.它没有在服务器数据目录上设置适当的权限。运行以下命令来root
修复它:
chown -R mysql:mysql /var/lib/mysql
答案4
我的 Raspberry Pi 上出现此错误。转到/var/lib/mysql
并发现一个名为raspberrypi.err
.在其中我看到在启动过程中它发现了一条/etc/mysql/my.cnf
它不喜欢的线。在我的例子中,有问题的行是,bind-address
但这可能是一个开始寻找的好地方。