• 查看MySQL配置文件路径及相关配置


    (1)关于配置文件路径

    有时候,我发现虽然尝试修改了配置文件的一些变量,但是并没有生效。后来才发现原来是因为修改的文件并非MySQL服务器读取的配置文件。

    如果不清楚MySQL当前使用的配置文件路径,可以尝试这样查看:

    [mysql@linuxtest ~]$ mysqld --verbose --help|grep -A 1 'Default options'

    或者是执行:

    [mysql@linuxtest ~]$ mysql --verbose --help|grep -A 1 'Default options'

    [mysql@linuxtest ~]$ mysqld --verbose --help|grep -A 1 'Default options'
    2015-12-01 17:23:56 0 [Note] mysqld (mysqld 5.6.27-75.0-log) starting as process 6858 ...
    2015-12-01 17:23:56 6858 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 10005)
    
    2015-12-01 17:23:56 6858 [Warning] Buffered warning: Changed limits: max_connections: 214 (requested 2000)
    
    2015-12-01 17:23:56 6858 [Warning] Buffered warning: Changed limits: table_open_cache: 400 (requested 2000)
    
    2015-12-01 17:23:56 6858 [Note] Plugin 'FEDERATED' is disabled.
    Default options are read from the following files in the given order:
    /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf 
    2015-12-01 17:23:56 6858 [Note] Binlog end
    2015-12-01 17:23:56 6858 [Note] Shutting down plugin 'CSV'
    2015-12-01 17:23:56 6858 [Note] Shutting down plugin 'MyISAM'
    
    
    [mysql@linuxtest ~]$ mysql --verbose --help|grep -A 1 'Default options'
    Default options are read from the following files in the given order:
    /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf 



    从上图可以看出, 服务器首先会读取/etc/my.cnf文件,如果发现该文件不存在,再依次尝试从后面的几个路径进行读取。


    (2)关于配置文件配置项分段

    配置文件my.cnf通常会分成好几部分,如[client],[mysqld], [mysql]等等。MySQL程序通常是读取与它同名的分段部分,例如服务器mysqld通常读取[mysqld]分段下的相关配置项。如果配置项位置不正确,该配置是不会生效的。详细文档我觉得可以参考这篇文章:http://www.blogjava.net/hunter129/archive/2009/01/18/251744.html


    (3)关于全局变量

    另外,如果想查看MySQL的一些全局变量设置,在非登录并有权限情况下可以这样查看: mysqladmin variables -p,

    这个操作也就相当于登录时使用命令 show global variables;

  • 相关阅读:
    自动化测试工具Telerik Test Studio发布R1 2019|附下载
    DevExpress ASP.NET Core Controls v18.2新功能详解
    DevExpress WinForms使用教程:Diagram Control
    JDK1.8源码——java.util.Arrays 类
    JDK1.8源码——java.util.HashMap 类
    哈希表
    JDK1.8源码——java.lang.String 类
    HDU1811 Rank of Tetris (并查集)
    CF149D Coloring Brackets (区间dp)
    POJ2464 Brownie Points II(树状数组+思维)
  • 原文地址:https://www.cnblogs.com/huangmr0811/p/5570992.html
Copyright © 2020-2023  润新知