• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

MySQL Fails to Start Using systemctl On systemd Linux Distributions

by admin

Problem

When trying to start MySQL using systemctl fails to start, for example:

# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

Solution

There can be multiple causes for this. Some (but not limited to) examples are:

  • A typo in a configuration option in the MySQL configuration file.
  • Presence of a no longer used option in the MySQL configuration file.
  • Wrong file system level permission.

To investigate what error is causing MySQL not to start, there are several sources that can be used:

1. The MySQL error log

By default this is located in /var/log/mysqld.log but may be in a different location if the log-error option is set in the MySQL configuration file. This is the best place to start, however depending on the error, the startup process may not even have gotten far enough to write to the MySQL error log.

2. Check the output of “systemctl status mysqld”

The output of “systemctl status mysqld” can also be helpful to identify the cause of the failure.

# systemctl status mysqld

3. The systemd journal

The systemd journal can help to get to the root cause of failure. You can for example browse it interactively using:

# journalctl -xe

If you need to get the journal to be uploded to get it anlyzed by vendor, you need to determine where it is located. This is system specific. For example with the default configuration, the journal on CentOS/RHEL 7 can be found in a subdirectory below /run/log/journal/, for example /run/log/journal/1ffd55f216ea46bd82d0f144065cc29b/system.journal. Another location may be /var/log/journal.

Or you can export the journal like:

# journalctl > journal.log

Once the error message has been determined, use that to investigate the root cause.

Filed Under: CentOS/RHEL 7, Linux, mysql, OEL 7

Some more articles you might also be interested in …

  1. What is the purpose of “system user” in MySQL Replication
  2. “cannot install the best update candidate for package” – error on running dnf update
  3. lvmconf Command Examples in Linux
  4. CentOS / RHEL 7 : Beginners guide to firewalld
  5. How to Automatically Run ntpdate When Starting NTPD in CentOS/RHEL 5
  6. How to disable firewalld and and switch to iptables in CentOS / RHEL 7
  7. How to Configure NFS Services (server-side) to Run on Static Ports as an Alternative CentOS/RHEL 7
  8. Granting All Privileges On All databases Except One Specific Table in MySQL
  9. ufw Command Options
  10. How to add additional language support in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright