mysql初始化提示权限不足mysqld: Can't change dir to Errcode: 13 - Permission denied

问题描述

[root@c6-172-24-20-50 mysql_data]# /servyou/mysql/bin/mysqld --initialize-insecure --lower_case_table_names=1 --default_authentication_plugin=mysql_native_password  --user=mysql --basedir=/servyou/mysql --datadir=/home/weblogic/mysql_data mysqld: Can't change dir to '/home/weblogic/mysql_data/' (Errcode: 13 - Permission denied) 2022-05-12T12:49:56.401184Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-05-12T12:49:56.403011Z 0 [ERROR] failed to set datadir to /home/weblogic/mysql_data/ 2022-05-12T12:49:56.403023Z 0 [ERROR] Aborting 

问题分析

错误日志提示

查看目录下隐藏的权限,发现上级目录是weblogic,经过测试发现是weblogic的家目录

解决:datadir不要设置在系统账户的家目录

继续分析

逐级分析那层目录的other没有执行权限导致的问题 ls -l /home ls -l /home/weblogic ls -l /home/weblogic/m1  chmod  o+x /xxx   // chmod o+rx /xxx