There is no mysql in /var/lib where I expected to find the databases and tables.


There should be files named mysql at least at these locations


You can check if there is a running mysql with...

ps -ef |grep mysql

Or type mysql on command line. It will show an error if there is a mysql:

ERROR 1045 (28000): Access denied for user 'xxxx'@'localhost' (using password: NO)

If there is no mysql in /etc/ you do not have it installed. /var/lib/ is optional so not a good directory to test if you have a mysql instance; the location of the data directory is defined in /etc/mysql/my.cnf (look for datadir). If that shows something other than /var/lib/ you need to use that directory to find the database files.


You can check the datadir in the various configuration files:

grep datadir /etc/mysql/my.cnf
grep datadir /etc/mysql/mysql.conf.d/mysqld.cnf
grep datadir /etc/mysql/conf.d/mysql.cnf
grep datadir ~/.my.cnf

By priority:

  1. ~/.my.cnf
  2. /etc/mysql/mysql.conf.d/mysqld.cnf

    With these lines in /etc/mysql/my.cnf

    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mysql.conf.d/
  3. /etc/mysql/conf.d/mysqld.cnf

    With these lines in /etc/mysql/my.cnf

    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mysql.conf.d/
  4. /etc/mysql/my.cnf

    If your changes are placed before the lines

    !includedir /etc/mysql/conf.d/
    !includedir /etc/mysql/mysql.conf.d/

    If you make changes after this lines, than the priority is 2.

  • 1
    If you list it like that I would advice to include in what order these files are prioritized (I would assume ~/.my.cnf takes precedence but the other 3 I could make case for any of them to be 1st priority ;) ). – Rinzwind Jul 10 '15 at 8:40
  • @Braiam thank you o_O I don't know, why I used cat. – A.B. Jul 10 '15 at 14:13

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.