Home  >  Article  >  Database  >  How to install mysql default configuration file location in Linux

How to install mysql default configuration file location in Linux

WBOY
WBOYforward
2023-05-31 15:58:061590browse

How to install mysql default configuration file location in Linux

The solution is as follows:

1. Check the installation location of mysql through which mysqld command

How to install mysql default configuration file location in Linux

2 .View the default path of the configuration file used by mysql through the /usr/local/mysql/bin/mysqld –verbose –help |grep -A 1 ‘Default options’ command. (Note that the red mark is the command passed in step 1. Obtained mysql installation directory path)

How to install mysql default configuration file location in Linux

As shown in the above figure, we can see that the order and location of mysql reading configuration file paths, first check /etc/mysql /Does the my.cnf configuration file exist below? If not, we can get a configuration file under /etc. So where does the configuration file come from?

4. Get the my.cnf configuration file

How to install mysql default configuration file location in Linux

As shown in the picture above, we first switch to the support-files directory of the mysql installation directory and view the following file information through the ll command

Through cp -r /usr /local/mysql/support-files/my-default.cnf /etc/ Copy the configuration file to /etc

Switch to the /etc directory and copy the file through mv my-default.cnf my.cnf Change the name

5. Edit my.cnf, specify the mysql installation path and the mysql data file storage path. The following figure also configures bin-log. When configuring bin-log, you need to specify server_id

How to install mysql default configuration file location in Linux

6. At this point, our mysql configuration file has been sorted out. You can open bin-log and restart mysql to check whether the configuration takes effect. If it takes effect, the above configuration is successful. If it cannot be started after modifying my.cnf, you can check the error message as follows

How to install mysql default configuration file location in Linux

The above is the detailed content of How to install mysql default configuration file location in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete