mysql error : ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)

前端 未结 6 1693
予麋鹿
予麋鹿 2020-12-13 08:36

when i try to view the databases in mysql i get this error:

ERROR 1018 (HY000): Can\'t read dir of \'.\' (errno: 13)

And that stops my app

相关标签:
6条回答
  • 2020-12-13 09:11

    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/.

    0 讨论(0)
  • 2020-12-13 09:14
    chown -R mysql:mysql /var/lib/mysql/
    
    chmod -R 755 /var/lib/mysql/
    

    I can confirm that these two chmod statements worked for me (Webmin didn't see the databases nor did show tables) but I'm not sure why I had to do this after setting up perhaps two dozen servers (Centos) with MySQL in that past few years.

    0 讨论(0)
  • 2020-12-13 09:19

    osx high sierra use the following command solves the issue:

    chown -R mysql:mysql /usr/local/mysql
    
    0 讨论(0)
  • 2020-12-13 09:23

    On CentOS/RedHat, you should do the same thing on a different path:

    chown -R mysql:mysql /data/mysql/
    chmod -R 755 /data/mysql/
    
    0 讨论(0)
  • 2020-12-13 09:25

    For Us OS X Users, this should work:

    sudo chown -R mysql:mysql /usr/local/mysql/
    sudo chmod -R 755 /usr/local/mysql/
    

    Edit: Depending on how you installed mysql your mileage my vary. I installed using the mysql community server dmg installer on mysql.com

    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/

    0 讨论(0)
  • 2020-12-13 09:31

    if you installed mariadb using homebrew you can run the following the command for OS X

    sudo chown -R mysql:mysql /var/lib/var/mysql/
    sudo chmod -R 777 /usr/local/var/mysql/
    
    0 讨论(0)
提交回复
热议问题