[MY-013276] [Server] Failed to set datadir to ‘/usr/local/mysql/data/‘ (OS errno: 13 - Permission de

背景

[MY-013276] [Server] Failed to set datadir to ‘/usr/local/mysql/data/‘ (OS errno: 13 - Permission de_第1张图片

 使用root账户安装了mysql

启动异常

问题

A1 直接使用mysqld 启动报错如下

[Server] Failed to set datadir to '/usr/local/mysql/data/' (OS errno: 13 - Permission denied)

[MY-013276] [Server] Failed to set datadir to ‘/usr/local/mysql/data/‘ (OS errno: 13 - Permission de_第2张图片

看着是权限不够,升级个权限吧。。

A2 切换至root账户启动

2022-03-01T13:47:50.047941Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

解决

B1

 mysqld 命令指定用户

--user=root

--user=mysql

都可以, 但是使用root用户后,因为提升了相关权限,不能再降级到mysql用户。

[MY-013276] [Server] Failed to set datadir to ‘/usr/local/mysql/data/‘ (OS errno: 13 - Permission de_第3张图片

B2

在/etc/my.cnf配置启动用户

user=root

参考

[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as r_有一种人仅仅是认识就很好了的博客-CSDN博客
MySQL错误记录(1)--File './binlog.index' not found_YoFog的博客-CSDN博客_mysql-binlog.index
 

你可能感兴趣的:(开发环境搭建,mysql,数据库,database)