当前位置:网站首页>[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
边栏推荐
- 阅读笔记:Secure Federated Matrix Factorization
- LeetCode刷题|368最大整除子集(动态规划)
- Leak detection and vacancy filling (IV)
- 2021-09-18
- Solution to page cache problem (use with caution)
- 基于DPDK实现VPC和IDC间互联互通的高性能网关
- thinkphp5 ---- object(think\response\Json)转数组
- Tensorflow&&Pytorch常见报错
- 【代码解析(4)】Communication-Efficient Learning of Deep Networks from Decentralized Data
- 压力测试工具 Jmeter
猜你喜欢
随机推荐
页面缓存问题解决方法(慎用)
window环境下使用小皮面板安装redis
JS实现模态框拖拽
ebfp编程常用API介绍
Mailbox string judgment
JS实现网页轮播图
2021-09-18
Oracle数据库性能分析之常用视图
【ES6快速入门】
rdma网络介绍
AttributeError: ‘dict‘ object has no attribute ‘iteritems‘
Kids and COVID: why young immune systems are still on top
MySQL Server单机部署手册
tp5 报错variable type error: array解决方法
【代码解析(3)】Communication-Efficient Learning of Deep Networks from Decentralized Data
Method of MySQL password expiration
阅读笔记:Secure Federated Matrix Factorization
LeetCode刷题|13罗马数字转整数
TypeScript(下)
thinkphp5 ---- object(think\response\Json)转数组









