修改mariadb代码中默认读取/etc/my.cnf
时间: 2023-08-06 22:03:00 浏览: 47
要修改MariaDB代码中默认读取/etc/my.cnf的行为,可以按照以下步骤进行操作:
1. 打开MariaDB源代码目录,在其中搜索my_default.cnf文件。该文件是MariaDB默认的配置文件模板,其中包含了MariaDB默认的配置参数。
2. 在my_default.cnf文件中,找到以下行:
```
!includedir /etc/my.cnf.d/
!includedir /etc/mysql/conf.d/
```
这两行指定了MariaDB会读取/etc/my.cnf.d/和/etc/mysql/conf.d/目录下的配置文件。如果想要修改MariaDB默认读取/etc/my.cnf文件,可以将这两行注释掉或者删除。
3. 修改完成后,重新编译MariaDB并安装即可使修改生效。
需要注意的是,修改MariaDB源代码可能会影响到MariaDB的稳定性和安全性,建议只在必要的情况下进行修改,并在修改前备份好数据库。
相关问题
ubuntu mysql8.0.32 /etc/mysql/my.cnf 文件内容
以下是在Ubuntu系统上安装MySQL 8.0.32后的默认 /etc/mysql/my.cnf 文件内容:
```
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
#skip-external-locking
skip-name-resolve
skip-host-cache
skip-ssl
sql-mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Ubuntu UTF-8 is default
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysql]
#
# * Basic Settings
#
socket = /var/run/mysqld/mysqld.sock
prompt = \u@\h [\d]>\_
[mysqldump]
#
# * Basic Settings
#
socket = /var/run/mysqld/mysqld.sock
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
```
注意,这只是默认的配置文件,实际上你可以根据需要进行修改。
http://archive.mariadb.org/mariadb-10.3.34/yum/centos/$releasever/$basearch
http://archive.mariadb.org/mariadb-10.3.34/yum/centos/$releasever/$basearch 是一个URL地址,指向MariaDB数据库的软件包存储库。这个存储库中包含了MariaDB 10.3.34版本的软件包,适用于CentOS操作系统的特定版本和架构。
通过访问这个URL,你可以获取到MariaDB 10.3.34版本的软件包,以便在CentOS操作系统上安装和使用MariaDB数据库。
请注意,$releasever和$basearch是变量,需要根据你的具体情况进行替换。$releasever表示CentOS操作系统的版本号,$basearch表示操作系统的架构(如x86_64)。
如果你需要安装MariaDB 10.3.34版本,可以按照以下步骤进行操作:
1. 打开终端或命令行界面。
2. 使用wget或curl命令下载软件包存储库的repo文件,例如:
```
wget http://archive.mariadb.org/mariadb-10.3.34/yum/centos/7/x86_64/mariadb.repo
```
这里假设你使用的是CentOS 7操作系统,并且架构为x86_64。
3. 将下载的repo文件移动到/etc/yum.repos.d/目录下,例如:
```
sudo mv mariadb.repo /etc/yum.repos.d/
```
4. 运行以下命令更新软件包缓存并安装MariaDB:
```
sudo yum update
sudo yum install MariaDB-server
```
这将更新软件包缓存并安装MariaDB服务器。
希望以上信息对你有帮助!如果你有任何其他问题,请随时提问。