简体   繁体   English

MySql:ERROR 1018(HY000):无法读取'。'的目录。 (错误:13)

[英]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服务器后,

  1. renamed /var/lib/mysql to mysql.orig /var/lib/mysql to mysql.orig重命名/var/lib/mysql to mysql.orig

  2. in /var/lib, I made a directory mysql 在/ var / lib中,我创建了一个目录mysql

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

相关问题 MySQL错误代码1005,SQL状态HY000:无法创建表“ cpis.cpis_sudent_profile”(错误号:150) - MySQL Error code 1005, SQL state HY000: Can't create table 'cpis.cpis_sudent_profile' (errno: 150) SQLSTATE [HY000]:常规错误:13无法获取“ ./pics”的统计信息(错误代码:13-权限被拒绝) - SQLSTATE[HY000]: General error: 13 Can't get stat of './pics' (Errcode: 13 - Permission denied) 错误1005(HY000):无法创建表“ db.POSTS”(错误号:150) - ERROR 1005 (HY000): Can't create table 'db.POSTS' (errno: 150) ERROR 2002 (HY000): 无法通过 socket '/var/lib/mysql/mysql.sock' (13) Ubuntu 连接到本地 MySQL 服务器 - ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) Ubuntu MySQL ERROR 2002 (HY000): 无法通过套接字连接到本地 MySQL 服务器 - MySQL ERROR 2002 (HY000): Can't connect to local MySQL server through socket SQLSTATE [HY000] [2003]无法连接到MySQL服务器 - SQLSTATE[HY000] [2003] Can't connect to MySQL server 错误2003(HY000):无法连接到“本地主机”上的MySQL服务器(10061“未知错误”) - ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061 “Unknown error”) SQLSTATE[HY000]: 一般错误: 1005 Can't create table `school`.`posts` (errno: 150 "Foreign key constraint is wrongly forms") - SQLSTATE[HY000]: General error: 1005 Can't create table `school`.`posts` (errno: 150 "Foreign key constraint is incorrectly formed") SQLSTATE[HY000]:一般错误:无法创建表 - SQLSTATE[HY000]: General error:Can't create table 运行MySQL的帮助。 SQL yog给出错误HY000):无法连接到“本地主机”上的MySQL服务器(10061) - Help in Running MySQL. SQL yog gives error HY000): Can't connect to MySQL server on 'localhost' (10061)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM