23

I'm sorry if this question has already been asked, but I can't find any solution to this (maybe small) issue:

I just made a fresh install of mysql-server 5.7 on a 14.04 server. Every time the MySQL service starts, I get this error:

root@xxx:/etc/mysql# service mysql restart
 * Stopping MySQL Community Server 5.7.11
...
 * MySQL Community Server 5.7.11 is stopped
 * Re-starting MySQL Community Server 5.7.11
No directory, logging in with HOME=/
..
 * MySQL Community Server 5.7.11 is started

What does that mean? Do I have to set a home directory to the user "mysql"? (and if so, what is the best choice? /home/mysql??) Now it's to /nonexistent:

mysql:x:110:106:MySQL Server,,,:/nonexistent:/bin/false

but I have another machine with the same /nonexistent, and it doesn't show any error...

2

2 Answers 2

48

Having same issue to get rid of this error i did the following

  1. Stop MYSQL service:

    sudo service mysql stop

  2. Change home directory of mysql from nonexistent to original directory where it is supposed to be:

    sudo usermod -d /var/lib/mysql/ mysql

Now start mysql server again with:

sudo service mysql start

The error message has disappeared. Still why this happen is unknown.

10
  • 1
    It might be a work around but I would disagree with this. /home/ is for users. Not for creating a place for dummy users that are needed for security/permissions/whatever. The person suggesting /home/mysql and creating an actual mysql user should be seriously reprimanded.
    – Rinzwind
    Commented Feb 23, 2016 at 11:15
  • 2
    yea this is a workaround let me know when you find a solution. Commented Feb 24, 2016 at 5:51
  • 1
    According to this post, Red Hat has mysql home directory set to /var/lib/mysql. So this seems ok....
    – ostrokach
    Commented Jun 12, 2016 at 23:30
  • 3
    For what it's worth, I got this error when I was running mysql in Windows WSL. The error stopped happening after I quit mysqld.exe on Windows. Port 3306 was claimed by the Windows process.
    – Azeirah
    Commented Feb 20, 2019 at 23:09
  • 1
    Same for me was getting in WSL there was a process with mysqlid quit it and it worked.
    – garg10may
    Commented Apr 5, 2019 at 10:31
1

I would furtrher suggest a permanent solution, if it always run from the same dir as I suppose it should why not edit the user mysql in /etc/passwd:

mysql:x:106:111:MySQL Server,,,:/var/lib/mysql/:/bin/false

You must log in to answer this question.

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