# MySQL 数据库 Ubuntu 配置文件位置

**URL:** <https://www.isharkfly.com/t/mysql-ubuntu/17273>\
**Category:** 数据库\
**Tags:** mariadb, mysql\
**Created:** [May 4, 2025, 4:17pm UTC](https://www.isharkfly.com/t/mysql-ubuntu/17273 "2025-05-04T16:17:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [May 4, 2025, 4:17pm UTC](https://www.isharkfly.com/t/mysql-ubuntu/17273/1 "2025-05-04T16:17:49Z")

</div>

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

使用命令：`mysql --help`

命令输出为：

```auto
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

```

 ![2025-05-04_12-16-38](https://com-isharkfly-discourse.s3.dualstack.us-east-2.amazonaws.com/com-isharkfly-www/discourse-uploads/original/3X/f/a/fa62c3ade0c7952a771e24c9f6022ff2d90ff967.jpeg)

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

- /etc/my.cnf
- /etc/mysql/my.cnf
- $MYSQL\_HOME/my.cnf
- [datadir]/my.cnf
- ~/.my.cnf
