吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 779|回复: 5
收起左侧

[求助] 关于yum安装mariadb后自定义配置文件报错求助

[复制链接]
sxfxtf 发表于 2022-4-1 19:42
用的是yum安装mariadb,配置yum源,下载 安装 然后systemctl start mariadb 都成功.

image.png

此时my.cnf配置文件是这样的.只是设置了些字符编码

[Python] 纯文本查看 复制代码
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
log-error=/var/log/mysqld.log
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8



然后想自定义mariadb的data,log路径,于是配置文件添加了几行, mkdir -p /opt/local/mysql,
[Python] 纯文本查看 复制代码
[mysqld]
basedir = /opt/local/mysql
datadir=/opt/local/mysql/data
pid-file = /opt/local/mysql/mysql.pid
log-error = /opt/local/mysql/logs/mysqld.log
character-set-server=utf8
collation-server=utf8_general_ci
log-error=/var/log/mysqld.log
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8


再次运行就报错,麻烦各位看下 /opt/local/mysql  我也chmod 777权限了  为何还是报错,如果要自定义日志和数据库路径 要怎么操作呢,卡了三天了 难受啊
image.png

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Saryta 发表于 2022-4-1 22:03
本帖最后由 Saryta 于 2022-4-1 22:05 编辑

https://support.cpanel.net/hc/en-us/articles/360054053813-How-to-Enable-the-Error-Log-in-MySQL-or-MariaDB
试试这个,log_error
mysqld: log-error
mariadb: log_error
 楼主| sxfxtf 发表于 2022-4-1 22:28
Saryta 发表于 2022-4-1 22:03
https://support.cpanel.net/hc/en-us/articles/360054053813-How-to-Enable-the-Error-Log-in-MySQL-or-Ma ...

还是不行,似乎不是这个问题.
Saryta 发表于 2022-4-1 23:26
本帖最后由 Saryta 于 2022-4-1 23:29 编辑

我在centos7中试了一下这样没什么问题,getenforce看一下selinux运行模式,我这里唯一的问题就是Enforing导致了无法启动,设置为Permissive就可以了,setenforce 0 或从配置文件中永久修改。

[root@localhost ~]# cat /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
datadir=/opt/local/mysql
socket=/opt/local/mysql/mysql.sock
log-error=/opt/local/mysql/logs/mysqld.log
character-set-server=utf8
collation-server=utf8_general_ci
#log-error=/var/log/mysqld.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

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

[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

#
# include all files from the config directory
!includedir /etc/my.cnf.d
大罗金仙 发表于 2022-4-2 00:08
好东西,拿走了
 楼主| sxfxtf 发表于 2022-4-2 12:42
Saryta 发表于 2022-4-1 23:26
[md]我在centos7中试了一下这样没什么问题,`getenforce`看一下selinux运行模式,我这里唯一的问题就是`Enf ...

多谢,我也找到问题了,一个是主组的权限没有设置mysql,另一个就是selinux
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 14:45

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表