当前位置:网站首页>[MySQL basics] startup options and configuration files
[MySQL basics] startup options and configuration files
2022-04-23 06:58:00 【Sebastien23】
【MySQL The basic chapter 】 Startup options and configuration files
mysqld Startup options
mysqld namely MySQL Server, Is in MySQL The program executed during the initialization of database service installation . perform mysqld When initializing the database , You can specify server startup options (server options).
# View all startup options
$ mysqld --verbose --help
abort-slave-event-count 0
allow-suspicious-udfs FALSE
archive ON
auto-increment-increment 1
auto-increment-offset 1
autocommit TRUE
automatic-sp-privileges TRUE
avoid-temporal-upgrade FALSE
back-log 80
basedir /home/jon/bin/mysql-5.7/
...
tmpdir /tmp
transaction-alloc-block-size 8192
transaction-isolation REPEATABLE-READ
transaction-prealloc-size 4096
transaction-read-only FALSE
transaction-write-set-extraction OFF
updatable-views-with-limit YES
validate-user-plugins TRUE
verbose TRUE
wait-timeout 28800
The configuration file :my.cnf
because MySQL Server There are many startup options , Usually not written directly on the command line , Instead, it is uniformly written into the configuration file , Then specify the file read startup option during initialization .
$ mysqld --defaults-file=/etc/my.cnf --initialize
Priority of configuration file
In the class Unix Operating system ,MySQL The configuration file required for startup will be found from top to bottom in the order shown in the table below .
| file name | effect |
|---|---|
| /etc/my.cnf | Global startup item |
| /etc/mysql/my.cnf | Global startup item |
| SYSCONFDIR/my.cnf | Global startup item |
| $MYSQL_HOME/my.cnf | The startup item of the server ( Server only ) |
| defaults-extra-file | Command line --defaults-extra-file Additional configuration files specified after |
| ~/.my.cnf | Startup items specific to the current user |
| ~/.mylogin.cnf | Client login path startup item ( Client only ) |
among ,SYSCONFDIR It means in use CMake build MySQL The path specified by this parameter , The default is... Under the compiled installation directory etc Catalog .
Be careful : If a startup item is repeatedly defined in the above configuration file for multiple times , The value that will take effect after the service is started will be MySQL Last The value found . The only exception is user This startup item , For safety reasons ,MySQL The first one I found user The value of will take effect .
for example , hypothesis /etc/my.cnf and ~/.my.cnf The startup items of the storage engine are defined in , Then the value defined in the next one shall prevail .
# vim /etc/my.cnf
default-storage-engine=InnoDB
# vim ~/.my.cnf
default-storage-engine=MyISAM
namely MySQL After the service is started, the default storage engine is MyISAM.
The format of the configuration file
Only one startup item can be written per line in the configuration file . Some startup items need to specify a value , Some don't . Its format is compared with that in the command line , Generally, you only need to remove the two short horizontal lines in front --. Use... In the configuration file # notes .
Use [group] You can specify startup items for different groups or programs separately .
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket=/tmp/mysql.sock
key_buffer_size=16M
max_allowed_packet=8M
[mysqldump]
quick
The following table shows different MySQL The startup item of the group that the program can read .
| The program name | Category | Groups that can be read |
|---|---|---|
| mysqld | Server side | [mysqld], [server] |
| mysqld_safe | Server side | [mysqld], [server], [mysqld_safe] |
| mysql.server | Server side | [mysqld], [server], [mysql.server] |
| mysql | client | [mysql], [client] |
| mysqladmin | client | [mysqladmin], [client] |
| mysqldump | client | [mysqldump], [client] |
We can also add the version to the configuration file group, and then limit the database version of the startup item application .
[mysqld-5.7]
sql_mode=TRADITIONAL
References
【1】https://dev.mysql.com/doc/refman/5.7/en/mysqld.html
【2】https://dev.mysql.com/doc/refman/5.7/en/mysqld-server.html
【3】https://dev.mysql.com/doc/refman/5.7/en/server-configuration.html
【4】https://dev.mysql.com/doc/refman/5.7/en/option-files.html
【5】https://dev.mysql.com/doc/refman/8.0/en/server-option-variable-reference.html
【6】https://dev.mysql.com/doc/refman/5.7/en/binary-log.html
版权声明
本文为[Sebastien23]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230557416440.html
边栏推荐
- Unix期末考试总结--针对直系
- 基于DPDK实现VPC和IDC间互联互通的高性能网关
- 阅读笔记:Secure Federated Matrix Factorization
- 阅读笔记:Meta Matrix Factorization for Federated Rating Predictions
- 时间格式不对,运行sql文件报错
- 【ES6快速入门】
- JS handwriting compatibility event binding
- 【代码解析(5)】Communication-Efficient Learning of Deep Networks from Decentralized Data
- Working principle and practice of browser
- Installing redis using a small leather panel in the window environment
猜你喜欢
随机推荐
tc ebpf 实践
阅读笔记:FedGNN: Federated Graph Neural Network for Privacy-Preserving Recommendation
Usage of if conditional statements in SQL
leetcode刷题之整数加一
rdma 介绍
useCenterHook
【代码解析(4)】Communication-Efficient Learning of Deep Networks from Decentralized Data
【MySQL基础篇】数据导出导入权限与local_infile参数
DNA reveals surprise ancestry of mysterious Chinese mummies
DNA reveals surprise ancestry of mysterious Chinese mummies
LeetCode刷题|897递增顺序搜索树
EF CORE在ASP.NET CORE项目中基于数据库优先模式生成实体模型
Unix期末考试总结--针对直系
leetcode刷题之x的算术平方根
【代码解析(5)】Communication-Efficient Learning of Deep Networks from Decentralized Data
JS performance optimization
The arithmetic square root of X in leetcode
[OSS file upload quick start]
并发优化请求
PHP unlimited classification and tree









