mysql error : ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
Solution 1:
You need to set ownership and permissions for directory:
chown -R mysql:mysql /var/lib/mysql/ #your mysql user may have different name
chmod -R 755 /var/lib/mysql/
Note: -R
makes commands recursive - you may omit it, if there is no subdirs in /var/lib/mysql/
.
Solution 2:
This should work for Mac users:
sudo chown -R mysql:mysql /usr/local/mysql/
sudo chmod -R 755 /usr/local/mysql/
If this doesn't work, try running which mysql
to see where your mysql installation is located, and then replace /usr/local/mysql/
in the command above with whatever is before the 'bin' directory.
For example, on my system which mysql
produces the following output:
/usr/local/mysql/bin/mysql
so my path is /usr/local/mysql/
Solution 3:
On CentOS/RedHat, you should do the same thing on a different path:
chown -R mysql:mysql /data/mysql/
chmod -R 755 /data/mysql/