Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief Analysis of cleaning Database Cache by executing MySQL Command

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the implementation of the MySQL command to clean up the database cache, hoping to supplement and update some knowledge, if you have other questions to understand, you can continue to follow my updated article in the industry information.

Log in to the database of the Discuz forum and execute the following MySQL commands:

[root@test1 control] # mysql-uroot-p

MySQL [(none)] > show databases

Use the database of the Discuz forum

Mysql > use discuzdb

Mysql > show tables

View the table structure in the Discuz forum database

Mysql > desc pre_ucenter_members

Query the login password of the administrator account of the Discuz forum

Mysql > mysql > select * from pre_ucenter_members where username= "admin"

Set a new password and generate a key with md5

Mysql > select md5 ("newpassword")

+-+

| | md5 ("newpassword") |

+-+

| | da0ad52378e990f8e35b0f9d73b9961d |

+-+

Change the password of the forum administrator user according to the MD5 value set above

Mysql > update pre_ucenter_members set password= "da0ad52378e990f8e35b0f9d73b9961d" where username= "admin"

Clean up the cache of the MySQL database respectively

Mysql > flush hosts

Query OK, 0 rows affected (0.00 sec)

Mysql > flush logs

Query OK, 0 rows affected (0.04 sec)

Mysql > flush privileges

Query OK, 0 rows affected (0.00 sec)

Mysql > flush tables

Query OK, 0 rows affected (0.01 sec)

Mysql > flush status

Query OK, 0 rows affected (0.00 sec)

Mysql > flush tables

Query OK, 0 rows affected (0.00 sec)

Mysql > flush status

Query OK, 0 rows affected (0.00 sec)

Then, log in to the forum now, enter the user name admin and the new password, and you can log in successfully.

The main way to clear the cache is to use the flush command in order to execute FLUSH, you must have reload permission

Flush hosts is mainly used to empty the host cache table

Flush logs mainly closes the current binary log file and creates a new file

The main purpose of flush privileges is to let the new permission take effect immediately, just in case, whenever the power is re-granted.

Flush tables mainly closes all open tables, and this operation will empty the contents of the query cache

Flush tables with read lock mainly closes all open tables and adds a read lock to all tables in the database.

Flush status resets most state variables to 0

Flush master deletes binary log files from all binary log index files

Flush query cache reorganizes the query cache to remove fragments and improve performance

Flush slave is similar to resetting replication, making the slave database forget the replication location of the master database

Read the above about the implementation of MySQL commands to clean up the database cache brief analysis, hoping to bring some help to everyone in the practical application. Due to the limited space in this article, it is inevitable that there will be deficiencies and need to be supplemented. If you need more professional answers, you can contact us on the official website for 24-hour pre-sales and after-sales to help you answer questions at any time.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report