一叶知秋.

业精于勤,荒于嬉;行成于思,毁于随。

ERROR 1018 (HY000): Can't read dir of './shopxo/' (errno: 13 - Permission denied)

环境:
CentOS7.8 64位
MySQL5.7.31

问题:

#查看shopxo库中表的时候报错,权限拒绝
mysql> use shopxo;
Database changed
mysql> show tables;
ERROR 1018 (HY000): Can't read dir of './shopxo/' (errno: 13 - Permission denied)

排查:

#查看shopxo数据库的权限
[root@201 /var/lib/mysql]# ls -ld /var/lib/mysql/shopxo
drwxr-x--- 2 root root 4096 Aug 25 11:17 /var/lib/mysql/shopxo
#发现目录归属为root

解决办法:

chown -R mysql.mysql /var/lib/mysql/shopxo

验证:

mysql> show tables;
+-----------------------------+
| Tables_in_shopxo            |
+-----------------------------+
| s_admin                     |
| s_answer                    |
| s_app_center_nav            |
| s_app_home_nav              |
+-----------------------------+
4 rows in set (0.00 sec)
posted @ 2020-08-25 18:15  ccku  阅读(625)  评论(0编辑  收藏  举报