Home > Database > Mysql Tutorial > body text

How to restore default settings in mysql

下次还敢
Release: 2024-04-14 19:51:14
Original
637 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:

<code>sudo service mysql stop</code>
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:

<code>[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</code>
Copy after login

4. Restart the MySQL service:

<code>sudo service mysql start</code>
Copy after login

5. Reset the MySQL database:

Use the following command to reset the MySQL database:

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

6. Reset the MySQL user:

Use the following command to reset the MySQL user:

<code>mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');</code>
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
Popular Tutorials
More>
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!