gpt4 book ai didi

使用另一个数据目录时,Mysql 服务器将无法工作

转载 作者:行者123 更新时间:2023-11-30 21:52:17 24 4
gpt4 key购买 nike

我有一个在 Amazon Linux AMI 上运行的 Amazon EC2 实例。我正在尝试使用以下配置文件 (/etc/my.cnf) 但 mysql 无法启动:

[mysqld]
datadir=/home/ec2-user/data/mysql
socket=/home/ec2-user/data/mysql/mysql.sock
log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port=3306
socket=/home/ec2-user/data/mysql/mysql.sock

我在日志文件中收到这些错误消息:

2017-10-12 14:06:33 20082 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-10-12 14:06:33 20082 [ERROR] Can't start server : Bind on unix socket: Permission denied
2017-10-12 14:06:33 20082 [ERROR] Do you already have another mysqld server running on socket: /home/ec2-user/data/mysql/mysql.sock ?
2017-10-12 14:06:33 20082 [ERROR] Aborting

当我将配置文件设置回以前的设置(到数据文件夹的备份)时,一切正常:

[mysqld]
datadir=/var/lib/mysql.bak
socket=/var/lib/mysql.bak/mysql.sock

log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port=3306
socket=/var/lib/mysql.bak/mysql.sock

这个问题的原因可能是什么?我已经检查了新数据文件夹的权限,但这并没有改变任何东西。

最佳答案

运行这个命令:

chgrp -R mysql /home/ec2-user/data/mysql
chown -R mysql /home/ec2-user/data/mysql

你能试试下面的配置文件吗?

[mysqld]
datadir=/home/ec2-user/data/mysql
socket=/var/lib/mysql.bak/mysql.sock

log-bin=/var/log/mysql/mariadb-bin
log-bin-index=/var/log/mysql/mariadb-bin.index
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[client]
port=3306
socket=/var/lib/mysql.bak/mysql.sock

关于使用另一个数据目录时,Mysql 服务器将无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46712349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com