[英]MySql : ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
Recently mysql crashed and I had no choice but to backup the contents of var/lib/mysql
to /home/backup/
and re-install the database. 最近mysql崩溃了,我别无选择,只能将
var/lib/mysql
的内容备份到/home/backup/
并重新安装数据库。
after re-installing mysql server, 重新安装mysql服务器后,
renamed /var/lib/mysql to mysql.orig
将
/var/lib/mysql to mysql.orig
重命名/var/lib/mysql to mysql.orig
in /var/lib, I made a directory mysql 在/ var / lib中,我创建了一个目录mysql
moved the contents from the home/backup
folder to /var/lib/mysql 将内容从
home/backup
文件夹移动到/ var / lib / mysql
Now by running mysql -u user -p
and when I call show databases
It give s the following error : 现在运行
mysql -u user -p
,当我调用show databases
它会出现以下错误:
MySql : ERROR 1018 (HY000): Can't read dir of '.'
MySql:ERROR 1018(HY000):无法读取'。'的目录。 (errno: 13)
(错误:13)
How to solve this? 怎么解决这个?
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/. 注意:-R使命令递归 - 如果/ var / lib / mysql /中没有子目录,则可以省略它。
Source: mysql error : ERROR 1018 (HY000): Can't read dir of '.' 来源: mysql错误:ERROR 1018(HY000):无法读取'。'的目录。 (errno: 13)
(错误:13)
For future users. 对于未来的用户。 Two more steps are needed: 1. chown -R mysql:mysql /var/lib/mysql/ 2. service mysql restart
还需要两个步骤:1。chown -R mysql:mysql / var / lib / mysql / 2. service mysql restart
And you are done! 你完成了! All your databases are back.
你的所有数据库都回来了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.