Database Reference
In-Depth Information
• To expire a table selectively, removing only rows older than a given age, you must
know the name of the column that indicates row-creation time:
DELETE FROM mysql . general_log WHERE event_time < NOW () - INTERVAL 1 WEEK ;
For automatic expiration, the statements for any of the techniques just described can be
executed within a scheduled event (see Recipe 9.8 ). For example:
CREATE EVENT expire_general_log
ON SCHEDULE EVERY 1 WEEK
DO DELETE FROM mysql . general_log
WHERE event_time < NOW () - INTERVAL 1 WEEK ;
22.6. Monitoring the MySQL Server
Problem
You want to check how the server is operating.
Solution
Let the server tell you about itself.
Discussion
As your MySQL server runs, you'll have questions about aspects of its operation or
performance. Or maybe it's not running and you want to know why. Here are some
example questions:
• Is the server running? If so, how long has it been up?
• Why does the server quit immediately after I start it?
• How many queries is my server processing?
• How many simultaneous connections does the server permit? Is it close to running
out?
• Is my slave replication server communicating with the master, or has replication
stopped?
• Are the key caches sized properly for efficient operation?
This section discusses what you can find out, and how, by surveying the types of infor‐
mation available and how to use that information to answer questions. The purpose is
not so much to consider specific monitoring problems as to illustrate your options so
you can begin to answer your own questions, whatever they are.
To answer a question like any of those just posed, do this:
Search WWH ::




Custom Search