一 问题描述
用yum方式安装MariaDB报错:
chown: invalid user: ‘mysql:mysql’
chown: invalid user: ‘mysql’
Cannot change ownership of the database directories to the 'mysql'
user. Check that you have the necessary permissions and try again.
chown: invalid user: ‘mysql:mysql’
chmod: cannot access ‘/var/lib/mysql/mysql’: No such file or directory
二 出错原因
yum安装MariaDB时,会自动尝试创建mysql用户,但由于缺少创建用户的权限,因此导致安装失败。
三 解决办法
chattr -ia /etc/passwd
chattr -ia /etc/group
chattr -ia /etc/shadow
chattr -ia /etc/gshadow
再重新yum install即可。