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

How to view the historical operation record of mysql under Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to view the historical operation record of mysql under Linux, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.

Under linux, every step of mysql is recorded by default in the. mysql_history file under the current operating system user. This file does not record the time of the operation, but only records the operation commands, including user creation, authorization, password change, etc., are recorded in clear text. In general, for security reasons, this file will be emptied to avoid information disclosure.

The steps of the experiment:

1. Enter the mysql service and enter a few lines of commands:

Because I logged in to mysql at the command line of the root user, I went to the root user directory to check the historical operation record file. Mysql_history. This. MySQL _ history is a hidden file.

You can see that all operation commands are recorded in clear text. In addition, the. mysql_history file does not record the actions of mysql command line interface users who have not been disconnected Only after you click exit, the .mysql_history file will record all the commands you executed before.

2. The client connects to the mysql service. Similarly, type a few lines of command at random:

There is no mysql service on the lxmtestmongdb machine, but all the operations just now have been recorded under the local / root/.mysql_history:

3. Modify the linux environment variable MYSQL_HISTFILE under the linux user's home directory:

[root@CentOStest1 ~] # export MYSQL_HISTFILE=/home/mysql/.mydb_history

Then repeat the actions in 1 and observe that all the operation history is recorded in the new file / home/mysql/.mydb_history:

Combined with the above experimental content, we can clearly understand the recording method of this historical operation record file. In general, the file will be made a soft link to / dev/null to empty the content directly. Note that it is useless to delete this file directly, because the next time a new mysql is connected, the file will be automatically generated again.

Thank you for reading this article carefully. I hope the article "how to View the Historical Operation record of mysql under Linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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