mysql database data changes in real-time monitoring

For the second development, a large part of it is to look for changes in files and databases to find

For database changes. We have not found relatively easy to use monitoring software to monitor changes in the database.

Today, I gave you an example of how to use the monitoring function mysql database that comes with change

1. Open the database configuration file my.ini (usually in the database installation directory) (D: \ MYSQL)

2, log = log.txt added in the last line of the code in the database

3, restart the mysql database

4, go to my database data directory is (D: \ MYSQL \ data) you will find more than a log.txt file

I was in the C: \ Documents and Settings \ All Users \ Application Data \ MySQL \ MySQL Server 5.5 \ data

test:

1, operation of the database

2, view the log.txt file contents if there are changes that you can monitor changes to mysql database

Query the database insert delete update can be found

I hope this article can help you develop faster secondary ^ _ ^

Storage log: By default, when turned on, all the logs are stored in the directory DataDir If you do not specify a name, then it will be named after the host name as the host name songcomputer, log on to the relevant songcomputer... . log file is closed and an open log Mysql: use the following command to see if logging is enabled: MySQL > Show the Variables like 'log_%';


Where Value is OFF indicates the service is not open, to open on my.ini only need to write the configuration information (my.ini for mysql installation directory), and then remove the preceding "#"

Number, and then restart the mysql service.

OK, now you see the log file specified was created. On the contrary, to stop the mysql logging service, simply my.ini in the corresponding configuration information that is removed

can.

>>>> appropriate use slow query log

Manual slow to read and modify the slow log log time show variables like 'long%' time will be slow log

Setting the slow log values set long_query_time = 2 focuses on binary files binary log: From the overview, I can see the log-bin my.ini configuration information does not specify a file extension, because even if you specify it on the extension Do not use. When mysql binary log file is created

When, in order to first create a "mysql_log_bin" as the name to ".index" suffix to the file;

And then to create a "mysql_log_bin" as a name to

".000001" as the file extension. When the service mysql restart once to ".000001" suffix of a file may increase, and the extension incremented by; if the log length exceeds

Max_binlog_size the upper limit (the default is 1G) will create a new log file;

Use flush

logs (mysql command character) or perform mysqladmin -u -p flush-logs (windows command prompt) will create a new log file.

Since writing is binary data, use Notepad to open the file can not see the normal data, how to see it?

BIN directory using mysqlbinlog command, such as:

SQL statements can also be viewed using mysql create binary file directory: Mysql> Show Master logs; view the current status of the binary file: mysql> Show Master Status; as for accurate read log files, readers need to read it carefully and deeply felt, there is no longer described the Austrian!

php Chinese net new course two-dimensional code

Guess you like

Origin www.cnblogs.com/sqlservertongbu/p/11013445.html