当前位置:网站首页>[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
边栏推荐
- Typescript (top)
- 【代码解析(4)】Communication-Efficient Learning of Deep Networks from Decentralized Data
- How to use DBA_ hist_ active_ sess_ History analysis database history performance problems
- Imitation scallop essay reading page
- 【不积跬步无以至千里】Oracle应用导数Ora-01455报错处理
- virtio 与vhost_net介绍
- rdma 编程详解
- JS performance optimization
- LeetCode刷题|897递增顺序搜索树
- JS性能优化
猜你喜欢
随机推荐
DDOS攻击/防御介绍
Batch modify / batch update the value of a field in the database
Number of stair climbing methods of leetcode
MySQL【sql性能分析+sql调优】
【Lombok快速入门】
SQL学习|集合运算
Introduction to the top 12 domestic databases in 2021
LeetCode刷题|368最大整除子集(动态规划)
使用百度智能云人脸检测接口实现照片质量检测
Promise(二)
openvswitch vlan网络实践
阅读笔记:Secure Federated Matrix Factorization
CentOS8搭建PHP8.0.3运行环境
ansible模块之include_tasks:为什么加了tags后导入的任务没有执行?
leetcode刷题之二进制求和
多线程
【漏网之鱼】Ansible AWX调用playbook传参问题
EF CORE在ASP.NET CORE项目中基于数据库优先模式生成实体模型
thinkphp5 ---- object(think\response\Json)转数组
Usage of if conditional statements in SQL