MySQL parameter files and parameters

Source: Internet
Author: User

MySQL parameter file is----MY.CNF

  1. 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]#

  2. 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]#

  3. 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.

  4. 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.

  5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.