Index
»
Newbie Corner
»
[SOLVED] Mysql doesn't start, Can't change dir to '/var/lib/mysql/'
Pages:
1
Topic closed
[SOLVED] Mysql doesn't start, Can't change dir to '/var/lib/mysql/'
My mysql install was working fine but now it doesn't start
$ mysqld --verbose
121202 22:41:34 [Warning] Can't create test file /var/lib/mysql/home.lower-test
121202 22:41:34 [Warning] Can't create test file /var/lib/mysql/home.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
121202 22:41:34 [ERROR] Aborting
121202 22:41:34 [Note] mysqld: Shutdown complete
I checked using mysql_safe & it seems to be a permission issue
$ mysqld_safe --user=mysql
121202 22:45:34 mysqld_safe Logging to '/var/lib/mysql/home.err'.
121202 22:45:35 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/bin/mysqld_safe: line 107: /var/lib/mysql/home.err: Permission denied
rm: cannot remove ‘/var/run/mysqld/mysqld.sock’: Permission denied
rm: cannot remove ‘/var/lib/mysql/home.pid’: Permission denied
/usr/bin/mysqld_safe: line 144: /var/lib/mysql/home.err: Permission denied
121202 22:45:35 mysqld_safe mysqld from pid file /var/lib/mysql/home.pid ended
/usr/bin/mysqld_safe: line 107: /var/lib/mysql/home.err: Permission denied
But the thing is /var/lib/mysql is already owned by mysql,
$ ls -la /var/lib/ | grep mysql
drwxrw-r-- 19 mysql root 4.0K Dec 2 22:29 mysql
$ ls -la /var/ | grep lib
drwxr-xr-x 29 root root 4.0K Nov 28 19:59 lib
$ ls -la / | grep var
drwxr-xr-x 13 root root 4.0K Nov 28 19:58 var
so anyone tell me what permissions I have gotten wrong & how can I get mysql to work again?
Last edited by cool (2012-12-02 18:26:18)
Re: [SOLVED] Mysql doesn't start, Can't change dir to '/var/lib/mysql/'
1. You have to start mysqld as root using either sudo or from your root account
2. The safest way to start mysql is using the unit file (systemd) or service file (rc.d) -- e.g. 'sudo systemctl mysqld start'
3. My /var/lib/mysql directory has the following permissions 700 and owner/group is mysql/mysql. With those permissions, you're not going to be able to view the contents of the directory unless you are root or that user.
Scott
Re: [SOLVED] Mysql doesn't start, Can't change dir to '/var/lib/mysql/'
Don't necrobump threads, especially solved ones:
https://wiki.archlinux.org/index.php/Co … bumping.22
Closing
Arch + dwm
•
Mercurial repos
•
Surfraw
Registered Linux User #482438