MySQL parameter file is----MY.CNF
How to determine which of the database reads, the command gives the answer
[[email protected] home]# MySQL--help |grep my.cnf
Order of preference, MY.CNF, $MYSQL _tcp_port,
/ETC/MY.CNF/ETC/MYSQL/MY.CNF/USR/LOCAL/MYSQL/ETC/MY.CNF ~/.my.cnf
[Email protected] home]#
Parameters are prepared for the client, some for the server
[Email protected] home]# CAT/ETC/MY.CNF | Grep-v "^#"
[Client]
port=3306
[Mysqld]
Datadir=/opt/mysql/data
Basedir =/usr/local/mysql
Socket=/usr/local/mysql/mysql.sock
User=mysql
Character_set_server=utf8
server_id = 12
Join_buffer_size = 128M
Sort_buffer_size = 2M
Pid-file=/opt/mysql/data/mysqld.pid
[Email protected] home]#
What is a parameter?
This is like a bond with a relationship like read_buffer_size=12m Read_buffer_size is a key 12M means
Divided into two types of dynamic and static (read-only), can also be divided into global and local, dynamic can be modified but only in the entire life cycle of MySQL server, after the next reboot will be re-loaded according to the parameter configuration file, so to permanently take effect or modify the configuration file, Local only valid for the current session, global for all re-up sessions, dynamic modification parameters using Set [Global] Variables=key.
View parameters
You can use show variables like "Variables_name" SELECT @ @session. variables_name SELECT @ @global. variables_name
If you view Read_buffer_size
Mysql> set read_buffer_size=524288;
Query OK, 0 rows affected (0.07 sec)
mysql> SELECT @ @session. read_buffer_size;
+----------------------------+
| @ @session. read_buffer_size |
+----------------------------+
| 524288 |
+----------------------------+
1 row in Set (0.00 sec)
mysql> SELECT @ @global. read_buffer_size;
+---------------------------+
| @ @global. read_buffer_size |
+---------------------------+
| 131072 |
+---------------------------+
1 row in Set (0.00 sec)
Mysql> Show variables like "read_buffer_size%";
+------------------+--------+
| variable_name | Value |
+------------------+--------+
| Read_buffer_size | 524288 |
+------------------+--------+
1 row in Set (0.00 sec)
You can see the same set of Read_buffer_size but the session and global are different because I didn't add global when I set it up.
What happens if I change a static parameter?
mysql> set global datadir= '/opt ';
ERROR 1238 (HY000): Variable ' DataDir ' is a read only Variable
Mysql>
This article is from "Yun Weibang" blog, please be sure to keep this source http://aklaus.blog.51cto.com/9724632/1632766
MySQL parameter files and parameters