mysql错误:错误1018(HY000):无法读取dir的'。 (errno:13) [英] mysql error : ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)

查看:357
本文介绍了mysql错误:错误1018(HY000):无法读取dir的'。 (errno:13)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试查看数据库在mysql我得到这个错误:

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

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

我的django调试器说:

My django debugger says:

(2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/my_database' (13)")

以下是我的设置文件:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'my_database',                      # Or path to database file if using sqlite3.
    'USER': 'root',                      # Not used with sqlite3.
    'PASSWORD': '****',                  # Not used with sqlite3.
    'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
    'PORT': '3306',                      # Set to empty string for default. Not used with sqlite3.

会导致问题的原因是什么?

What can cause the problem?

提前感谢

推荐答案

您需要为目录设置所有权和权限:

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/

注意: -R 使命令递归 - 如果 / var / lib / mysql / 中没有子目录,则省略它。

Note: -R makes commands recursive - you may omit it, if there is no subdirs in /var/lib/mysql/.

这篇关于mysql错误:错误1018(HY000):无法读取dir的'。 (errno:13)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆