0

I can't start mysql and when I run any type of start command, whether it be systemctl start mysql or service mysql start, I get the same error:

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

And when I run systemctl status mysql.service I get this: https://hatebin.com/iefidgteub

Or if I run mysql I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) so I looked around, and I ran find / -type s to try and locate the mysqld.sock file but in the output, mysqld.sock wasn't one of the files it returned

Then, if I try running mysqld, I get https://hatebin.com/nyszqpalec

13
  • How did you install MySQL?
    – Bert
    Aug 3, 2020 at 12:14
  • It seems clear from your screen capture that /var/lib/mysql-files does not exist and does not contain the mysql files. In many cases the default location is /var/lib/mysql. Check whether they are already there, or do a find for ibdata1. If they already exist somewhere else, set the path in /etc/my.cnf using datadir=/var/lib/mysql.
    – tater
    Aug 3, 2020 at 12:16
  • /var/lib/mysql does exist, but in /etc/mysql/mariadb.conf.d/50-server.cnf, datadir= is already set to /var/lib/mysql and in /etc/mysql/mysql.conf.d/my.cnf it's set to the same thing, though I did find out that in /etc/mysql/my.cnf one of the !includedir was set to /etc/mysql/conf.d instead of /etc/mysql/mysql.conf.d where all of those configuration files are, so I updated it and tried to start mysql but I still get the same error
    – Jakaboii
    Aug 3, 2020 at 12:29
  • Config is either being ignored or set to /var/lib/mysql-files somewhere. If you want a practical fix and don't mind a hack, mv /var/lib/mysql /var/lib/mysql-files. Otherwise you need to sort through the config files that are being read.
    – tater
    Aug 3, 2020 at 12:42
  • I did that, but still get the same error, what about the mysqld.sock file? Would that have anything to do with it?
    – Jakaboii
    Aug 3, 2020 at 13:11

1 Answer 1

0

Your error is in the log that you posted:

mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
2020-08-03T11:17:14.960692Z 0 [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files

Ensure the directory /var/lib/mysql-files exists and MySQL should start.

4
  • /var/lib/mysql-files doesn't exist, though /var/lib/mysql does
    – Jakaboii
    Aug 3, 2020 at 12:30
  • Could you post TEXT results of ls from the OS command prompt when in /var/lib/mysql ? Aug 3, 2020 at 17:15
  • Sure, I changed it to mysql-files as I was asked to in a comment above, here's the output: hatebin.com/hjocqqtlne
    – Jakaboii
    Aug 3, 2020 at 20:13
  • Your prompt was - root@ubuntu:/var/lib/mysql-files# when you requested the ls. Could you get to a prompt of /var/lib/mysql and request ls? Then post the results, please. I suspect mysql-files is an accidental folder that was created in the past. We do not normally see a folder named mysql-files in a typical install. Sep 19, 2020 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .