您需要设置目录的所有权和权限:
chown -R MysqL:MysqL /var/lib/MysqL/ #your MysqL user may have different namechmod -R 755 /var/lib/MysqL/
注意:-R使命令递归-如果中没有子目录,则可以省略/var/lib/MysqL/。
解决方法当我尝试在mysql中查看数据库时,出现此错误:
ERROR 1018 (HY000): Can’t read dir of ’.’ (errno: 13)
这使我的应用无法显示…
我的django调试器说:
(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.
是什么原因引起的?
提前致谢