现在我想在centos7上启动mysql使用service mysqld start
,但是我得到了以下错误:
操作系统:centos64位
Redirecting to /bin/systemctl start mysqld.service Job for mysqld.service failed.
See 'systemctl status mysqld.service andjournalctl -xn for details.
安装了以下内容时没有任何错误和警告:
mysql-community-bench-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-client-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-common-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-devel-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-embedded-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-libs-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-release-el7-5.noarch.rpm
mysql-community-server-5.7.5-0.6.m15.el7.x86_64.rpm
mysql-community-test-5.7.5-0.6.m15.el7.x86_64.rpm
systemctl -l status mysqld.service
[root@www mysql]# systemctl -l status mysqld.service
mysqld.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)
Active: activating (start-post) since Sun 2015-02-15 03:25:32 EST; 59s ago
Process: 29844 ExecStart=/usr/bin/mysqld_safe (code=exited, status=0/SUCCESS)
Process: 29833 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 29844 (code=exited, status=0/SUCCESS); : 29845 (mysql-systemd-s)
CGroup: /system.slice/mysqld.service
`-control
|-29845 /bin/bash /usr/bin/mysql-systemd-start post
`-30168 sleep 1
Feb 15 03:25:32 www mysqld_safe[29844]: 150215 03:25:32 mysqld_safe Logging to '/var/log/mysqld.log'.
Feb 15 03:25:32 www mysqld_safe[29844]: 150215 03:25:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 15 03:25:32 www mysqld_safe[29844]: /usr/bin/mysqld_safe: line 164: 29987 Killed nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null >> /var/log/mysqld.log 2>&1
Feb 15 03:25:32 www mysqld_safe[29844]: 150215 03:25:32 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
journalctl -xn
[root@www mysql]# journalctl -xn
-- Logs begin at Sat 2015-02-14 22:04:13 EST, end at Sun 2015-02-15 03:46:01 EST. --
Feb 15 03:45:32 www systemd[1]: mysqld.service holdoff time over, scheduling restart.
Feb 15 03:45:32 www systemd[1]: Stopping MySQL Community Server...
-- Subject: Unit mysqld.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun shutting down.
Feb 15 03:45:32 www systemd[1]: Starting MySQL Community Server...
-- Subject: Unit mysqld.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
Feb 15 03:45:32 www mysqld_safe[1286]: 150215 03:45:32 mysqld_safe Logging to '/var/log/mysqld.log'.
Feb 15 03:45:32 www mysqld_safe[1286]: 150215 03:45:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 15 03:45:33 www mysqld_safe[1286]: /usr/bin/mysqld_safe: line 164: 1429 Killed nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/nu
Feb 15 03:45:33 www mysqld_safe[1286]: 150215 03:45:33 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Feb 15 03:46:01 www systemd[1]: Starting Session 2660120 of user root.
-- Subject: Unit session-2660120.scope has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2660120.scope has begun starting up.
Feb 15 03:46:01 www systemd[1]: Started Session 2660120 of user root.
-- Subject: Unit session-2660120.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2660120.scope has finished starting up.
--
-- The start-up result is done.
Feb 15 03:46:01 www CROND[1522]: (root) CMD (run-parts /etc/cron.hourly)
cat /var/log/mysqld.log
[root@www mysql]# cat /var/log/mysqld.log
150213 03:00:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150213 03:00:57 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150213 03:10:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150213 03:10:56 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150213 03:20:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150213 03:20:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150213 03:30:55 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150213 03:30:55 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
怎么了?
答案 0 :(得分:1)
/ usr / bin / mysql-systemd-start当你在/etc/my.cnf文件中没有配置socket dir时,这个shell有bug。所以添加socket dir就行了。 mysql 5.6.32为我工作。
答案 1 :(得分:0)
日志有这一行:
Feb 15 03:25:32 www mysqld_safe [29844]:/ usr / bin / mysqld_safe:line 164:29987杀死了nohup / usr / sbin / mysqld --basedir = / usr --datadir = / var / lib / mysql --plugin-dir = / usr / lib64 / mysql / plugin --log-error = / var / log / mysqld.log --pid-file = /var/run/mysqld/mysqld.pid --socket = / var / lib / mysql / mysql.sock&lt; / dev / null&gt;&gt; /var/log/mysqld.log 2&gt;&amp; 1
我会检查这些目录上的文件perms。一切都应该由mysql.mysql
拥有我以前见过mysql.sock问题。我还想知道mysql-community-release-el7-5.noarch.rpm,其他一切都显然是64位。
答案 2 :(得分:0)
就我而言,我将/ var / log目录挂载到tempfs(笔记本电脑,节能)。在fstab中对它进行评论解决了这个问题,mysqld又开始了。
更改
log_error = /var/log/mysql/error.log
在/etc/mysql/mysql.conf.d/mysqld.conf中 到磁盘目录不工作。