mysql error : ERROR 1018 (HY000): Can#39;t read dir of #39;.#39; (errno: 13)(mysql 错误:错误 1018 (HY000):无法读取 . 的目录(错误号: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)
这会阻止我的应用程序显示...
And that stops my app from displaying...
我的 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):无法读取 '.' 的目录(错误号:13)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:mysql 错误:错误 1018 (HY000):无法读取 '.' 的目录(错误号:13)


基础教程推荐
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01