To restore the default settings of MySQL, you can perform the following steps: Stop the MySQL service. Reset the MySQL configuration file or create a new configuration file. Restart the MySQL service. Reset MySQL database and users.
How to restore the default settings of MySQL
The MySQL database system allows users to configure various settings according to their specific needs . However, in some cases it may be useful to reset these settings back to their default values.
Steps:
1. Stop the MySQL service:
sudo service mysql stop
2. Reset the MySQL configuration file:
Find the MySQL configuration file, usually located at/etc/mysql/my.cnf
. Open the file with a text editor and delete any customizations.
3. Create a new MySQL configuration file:
Create a new configuration file as follows:
[mysqld] # Networking bind-address = 127.0.0.1 port = 3306 # Logging and Replication log-bin = mysql-bin.log binlog-do-db = mysql binlog-ignore-db = mysql # General and Slow Query Log max_connections = 151 max_connect_errors = 10 slow_query_log = 1 slow_query_log_file = /var/log/mysql/mysql-slow.log long_query_time = 10
4. Restart the MySQL service:
sudo service mysql start
5. Reset the MySQL database:
Use the following command to reset the MySQL database:
mysql -u root -p mysql> RESET MASTER; mysql> FLUSH PRIVILEGES;
6. Reset the MySQL user:
Use the following command to reset the MySQL user:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
Now, MySQL has been restored to its default settings.
The above is the detailed content of How to restore default settings in mysql. For more information, please follow other related articles on the PHP Chinese website!