I wanted to install MySQL on my dev Fedora machine for my work. I followed the following tutorial: Install MySQL 8.0/5.7 on Fedora 30/29. However, when I tried to start the service via sudo systemctl start mysql.service, I was not able to.

> sudo systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.

> mysqld
2019-09-17T17:24:18.516842Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-09-17T17:24:18.516948Z 0 [Warning] Can't create test file /var/lib/mysql/xzhans-xps15-on-fedora.lower-test
2019-09-17T17:24:18.516967Z 0 [Note] mysqld (mysqld 5.7.27) starting as process 8754 ...
2019-09-17T17:24:18.518447Z 0 [Warning] Can't create test file /var/lib/mysql/xzhans-xps15-on-fedora.lower-test
2019-09-17T17:24:18.518455Z 0 [Warning] Can't create test file /var/lib/mysql/xzhans-xps15-on-fedora.lower-test
2019-09-17T17:24:18.518690Z 0 [ERROR] Could not open file '/var/log/mysqld.log' for error logging: Permission denied
2019-09-17T17:24:18.518704Z 0 [ERROR] Aborting

2019-09-17T17:24:18.518712Z 0 [Note] Binlog end
2019-09-17T17:24:18.518742Z 0 [Note] mysqld: Shutdown complete

However, the log file has correct permissions:

> sudo ls -la /var/log/mysqld.log 
-rw-r-----. 1 mysql mysql 42880 Sep 17 13:23 /var/log/mysqld.log

Any help is appreciated. Thanks in advance.

  • 2
    the obvious question, is mysql configured to be running under the Linux's mysql user or mysql group? – Raymond Nijland Sep 17 '19 at 18:57
  • @RaymondNijland I believe so as those files/directories were created by the application itself. After some further investigation, I believe SELinux is the cause here, like what this blog post is showing. My mentor and I were tired on fighting against SELinux and since we run the prod server with MariaDB on RHEL, we swtiched to MariaDB instead. – Xucong Sep 25 '19 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.