How to restore default settings in mysql

下次还敢
Release: 2024-04-14 19:51:14
Original
553 people have browsed it

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 default settings in mysql

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
Copy after login

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
Copy after login

4. Restart the MySQL service:

sudo service mysql start
Copy after login

5. Reset the MySQL database:

Use the following command to reset the MySQL database:

mysql -u root -p mysql> RESET MASTER; mysql> FLUSH PRIVILEGES;
Copy after login

6. Reset the MySQL user:

Use the following command to reset the MySQL user:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!