Linux查看MySQL配置文件路径及相关配置
生活随笔
收集整理的這篇文章主要介紹了
Linux查看MySQL配置文件路径及相关配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
(1)關于配置文件路徑
有時候,我發現雖然嘗試修改了配置文件的一些變量,但是并沒有生效。后來才發現原來是因為修改的文件并非MySQL服務器讀取的配置文件。
如果不清楚MySQL當前使用的配置文件路徑,可以嘗試這樣查看:
?
?
復制代碼
或者是執行:
?
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]分段下的相關配置項。如果配置項位置不正確,該配置是不會生效的。
(3)關于全局變量
另外,如果想查看MySQL的一些全局變量設置,在非登錄并有權限情況下可以這樣查看: mysqladmin variables -p,
這個操作也就相當于登錄時使用命令 show global variables;
?
總結
以上是生活随笔為你收集整理的Linux查看MySQL配置文件路径及相关配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python源码剖析_Python源码剖
- 下一篇: 开启Mysql远程登录账号