Centos7 not start MySQL or mariadb error

Source: Internet
Author: User

CENTOS7 system compiled and installed MySQL or Mariab can not start the service error


The error is as follows:
Job for Mysqld.service failed because the control process exited with error code. See "Systemctl Status Mysqld.service" and "Journalctl-xe" for details.


Workaround:


Depending on the prompts, use Systemctl status Mysqld.service and Journalctl-xe to see why the service failed to start
[[Email protected] ~] #systemctl status Mysqld.service


?. Mysqld.service-sysv:mysql database server.
Loaded:loaded (/ETC/RC.D/INIT.D/MYSQLD)
Active:failed (Result:exit-code) since Wed 2016-01-20 18:26:57 CST; 40s ago
Docs:man:systemd-sysv-generator (8)
process:2979 execstart=/etc/rc.d/init.d/mysqld Start (code=exited, Status=1/failure)


Jan 18:26:56 Allen systemd[1]: Starting sysv:mysql database server ....
Jan 18:26:57 Allen mysqld[2979]: MySQL Daemon failed to start.
Jan 18:26:57 Allen mysqld[2979]: Starting mysqld: [FAILED]
Jan 18:26:57 Allen systemd[1]: Mysqld.service:control process exited, code=exited Status=1
Jan 18:26:57 Allen systemd[1]: Failed to start sysv:mysql database server.
Jan 18:26:57 Allen systemd[1]: Unit Mysqld.service entered failed state.
Jan 18:26:57 Allen systemd[1]: Mysqld.service failed.



[Email protected] ~]# Journalctl-xe


--
--Unit Session-2.scope have begun starting up.
Jan 18:26:48 Allen sshd[2916]: Pam_unix (sshd:session): Session opened for user spark by (uid=0)
Jan 18:26:52 Allen su[2944]: (to root) spark on PTS/1
Jan 18:26:52 Allen su[2944]: Pam_unix (su-l:session): Session opened for user root by Spark (uid=1000)
Jan 18:26:56 Allen polkitd[909]: Registered authentication Agent for unix-process:2974:117137 (System bus name:1.25
Jan 18:26:56 Allen systemd[1]: Starting sysv:mysql database server ....
--Subject:unit Mysqld.service has begun start-up
--DEFINED-BY:SYSTEMD
--Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
--Unit Mysqld.service have begun starting up.
Jan 18:26:57 Allen mysqld[2979]: MySQL Daemon failed to start.
Jan 18:26:57 Allen mysqld[2979]: Starting mysqld: [FAILED]
Jan 18:26:57 Allen systemd[1]: Mysqld.service:control process exited, code=exited Status=1
Jan 18:26:57 Allen systemd[1]: Failed to start sysv:mysql database server.
--Subject:unit Mysqld.service has failed
--DEFINED-BY:SYSTEMD
--Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
--Unit Mysqld.service has failed.
--
--the result is failed.
Jan 18:26:57 Allen systemd[1]: Unit Mysqld.service entered failed state.
Jan 18:26:57 Allen systemd[1]: Mysqld.service failed.
Jan 18:26:57 Allen polkitd[909]: Unregistered authentication Agent for unix-process:2974:117137 (System bus name:1.



Unfortunately, the above information does not provide the real reason for the failure of the service to start. There is no information available to find


View the log file. As long as the MySQL service starts, the alarm log will have output information



[Email protected] ~]# Tail/var/log/mysqld.log


2017-07-17t10:00:19.935771z 0 [ERROR]/usr/sbin/mysqld:can ' t create/write to file '/var/run/mysqld/mysqld.pid ' ( Errcode:2-No such file or directory)
2017-07-17t10:00:19.935795z 0 [ERROR] Can ' t start server:can ' t create PID file:no such file or directory
170717 18:00:20 mysqld_safe mysqld from PID File/var/run/mysqld/mysqld.pid ended


The PID file cannot be created when MySQL is started


The terminal looked at the directory does not exist


Created the/var/run/mysqld/directory and restarted the MySQL service


[[Email protected] ~] #mkdir-P/var/run/mysqld/


[[email protected] ~]#/etc/init.d/mysqld start


Error:
Starting mysqld (via Systemctl): Job for Mysqld.service failed because the control process exited with error code. See "Systemctl Status Mysqld.service" and "Journalctl-xe" for details.
[FAILED]



To view logs:
[[Email protected] ~] #tailf/var/log/mysqld.log
2017-07-17t10:28:37.183387z 0 [ERROR]/usr/sbin/mysqld:can ' t create/write to file '/var/run/mysqld/mysqld.pid ' ( Errcode:13-permission denied)
2017-07-17t10:28:37.183431z 0 [ERROR] Can ' t start server:can ' t create PID File:permission denied
170717 18:28:37 mysqld_safe mysqld from PID File/var/run/mysqld/mysqld.pid ended
170717 18:32:06 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql


You can see whether the owner or the/var/run/mysqld/group or Root,mysql cannot create a file in it, and then modify the owner and the owner group of the directory. Restart database
[[Email protected] ~] #vll-D/var/run/mysqld/
Drwxr-xr-x 2 root root + Jan 18:28/var/run/mysqld/
[[Email protected] ~] #chown mysql:mysql/var/run/mysqld/
[Email protected] ~]#/etc/init.d/mysqld restart
Starting mysqld (via Systemctl): [OK]



Last Available Ps-ef | grep MySQL or Ss-anptlu | grep 3306 to see if the service is running or port no up






















This article is from the "12252646" blog, please be sure to keep this source http://12262646.blog.51cto.com/12252646/1948274

Centos7 not start MySQL or mariadb error

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.