MySQL載入配置檔案的順序

2021-09-07 04:23:35 字數 884 閱讀 8183

mysql5.6啟動時,按照下表,從上往下的順序載入配置檔案:

file name

purpose

/etc/my.cnf

global options

/etc/mysql/my.cnf

global options

sysconfdir/my.cnf

global options(cmake編譯mysql時,引數sysconfdir指定的值。預設是安裝後目錄下)

$mysql_home/my.cnf

server-specific options

包含my.cnf檔案的環境變數。如果沒有設定該環境變數,mysqld_safe會按照以下順序嘗試設定mysql_home的值:

·將basedir和datadir分別設定為mysql的base目錄和data目錄

·如果my.cnf檔案在datadir中,而不是在basedir中,mysqld_safe會將mysql_home設定為datadir的值

·如果my.cnf檔案在basedir中,而不是在datadir中,mysqld_safe會將mysql_home設定為basedir的值

mysql5.6中,datadir不再作為my.cnf檔案的存放位置

defaults-extra-file

the file specified with --defaults-extra-file=file_name, if any

~/.my.cnf

user-specific options

~/.mylogin.cnf

login path options

有多個配置檔案的時候,後面的配置檔案會覆蓋前面的配置。如果沒有配置檔案,mysql啟動的時候會按照編譯時的預設引數設定啟動例項。

bash配置檔案載入順序

2015 02 12 11 05 206人閱讀收藏 舉報 linux bash配置檔案的分兩大類 1,全域性配置,比如 etc profile,etc profile.d sh,etc bashrc 2,個人配置,比如 bash profile,bashrc 其中,profile類的檔案記錄的是 1...

springboot 配置檔案載入順序

載入本地其他配置檔案 nacos 作為配置中心 有註冊中心nacos 配置 spring boot 有兩種配置檔案 bootstrap.properties bootstrap.yml 定義應用級別的配置 在spring boot 有兩種上下文 bootstrap 應用程式的父上下文 建立配置檔案 ...

bash配置檔案的載入順序

bash配置檔案的載入順序和登陸方式有關,下面先介紹下登陸方式。登陸式shell 非登入式shell profile類檔案作用 bashrc類檔案作用 登陸式shelll配置檔案載入順序 etc profile bash profile bash login profile bash logout....