MySQL 数据库 Ubuntu 配置文件位置

在对数据库进行调整的时候,我们需要了解下 MySQL 的配置文件。

使用命令:mysql --help

命令输出为:

root@raspberrypi:~# mysql --help
mysql  Ver 15.1 Distrib 10.11.11-MariaDB, for debian-linux-gnu (aarch64) using  EditLine wrapper
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Usage: mysql [OPTIONS] [database]

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf 
The following groups are read: mysql mariadb-client client client-server client-mariadb

上面的输出,显示了配置文件的载入路径。

  • /etc/my.cnf
  • /etc/mysql/my.cnf
  • $MYSQL_HOME/my.cnf
  • [datadir]/my.cnf
  • ~/.my.cnf