1. 程式人生 > 其它 >mysql初始化提示許可權不足mysqld: Can't change dir to Errcode: 13 - Permission denied

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