Preface
(It is usually called in Unix/Linux systems
) is a configuration file of the MySQL database, used to specify various settings of the MySQL server, including character sets, ports, data directories, etc. Depending on the operating system and installation method, this file may be located in different locations. Here is the search
or
Some common locations for files:
Windows System
-
Default installation path:
-
C:\ProgramData\MySQL\MySQL Server \
or C:\Program Files\MySQL\MySQL Server \
in
Represents your MySQL version number.
-
Installation via MySQL Installer: If you are using MySQL Installer to install MySQL, the configuration file may be placed in one of the default locations mentioned above.
Custom path: If a different configuration file path is specified during the installation process, you need to refer to the installation record or documentation at that time.
-
View the path of the configuration file currently in use: You can view the location of the configuration file MySQL is using via the following command.
mysql> SHOW VARIABLES LIKE 'explicit_defaults_for_timestamp';
But a more direct way is to run it on the command line:
mysqld --verbose --help | findstr "Default options" -A 10
Unix/Linux system
-
Standard location:
/etc/
/etc/mysql/
-
~/.
(User-specific configuration)
-
Other possible locations: The configuration files are found in a specific order when the MySQL service starts. You can use the following command to find the configuration files that MySQL actually loads:
mysqld --verbose --help | grep -A 1 "Default options"
This command will list the order and location of the MySQL search configuration files.
-
In the Docker container: If MySQL is running in a Docker container, the configuration file may be provided by mounting the volume, or in a custom location inside the container. You can go to the container to check:
docker exec -it container_name bash
Specific steps to find configuration files
-
Windows:
Open File Explorer.
Navigate to one of the possible locations mentioned above.
If not found, try searching
or
document.
-
Linux/Unix:
Open the terminal.
uselocate
orfind
Command to find configuration files:orsudo updatedb # Update the database to ensure that locate can find the latest fileslocate
find / -name 2>/dev/null
Once the correct configuration file is found, you can edit it according to the guides provided before to modify the character set settings. Remember to restart the MySQL service after modification to make the changes take effect.
Summarize
This is the article about how each system finds database and modifys it. For more information about finding databases and modifying content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!