Use the shell to write a script to monitor the running state of the MySQL process, test if you can connect to MySQL, if not, send an email to the police. As for how to monitor, in fact there are many commands, such as most of the commands in the Mysql/bin directory can be used to test the running state of the MySQL process, as long as the hang off the command will return an error.
Mysqladmin, how to create a new table!
Used to perform administrative operations. The syntax is:
shell>; mysqladmin [OPTIONS] command [command-option] command ...
By executing mysqladmin--help, you can get a list of the options supported by your mysqladmin version.
Currently mysqladmin supports the following commands:
Create DatabaseName creates a new database
Drop DatabaseName Deletes a database and all its tables
Extended-status gives an extended status message to the server
Flush-hosts wash off all cached hosts
Flush-logs wash off all the logs.
Flush-tables wash off all the watches
Flush-privileges Load Authorization table again (same reload)
Kill Id,id,... Kill MySQL Thread
Password new password, change old password to new password
Ping Check if mysqld alive.
Processlist Display service List of active threads
Reload Overload Authorization Table
Refresh Erase all tables and close and open the log file
Shutdown, shut down the server.
Status gives a brief status message to the server
Variables print out available variables
Version gets the information about the server
All commands can be shortened to their unique prefix. For example:
shell>; mysqladmin proc Stat
+----+-------+-----------+----+-------------+------+-------+------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------+-----------+----+-------------+------+-------+------+
| 6 | Monty | localhost | | Processlist | 0 | | |
+----+-------+-----------+----+-------------+------+-------+------+
uptime:10077 threads:1 questions:9 Slow queries:0 opens:6 Flush tables:1
Open tables:2 Memory in use:1092k Max Memory used:1116k
The mysqladmin Status command results in the following columns:
Uptime the number of seconds the MySQL server has been running
Number of Threads active threads (Customers)
Questions number of customer issues initiated from mysqld
Slow queries number of queries that have exceeded long_query_time seconds
How many tables has the opens mysqld opened?
Flush tables Flush ..., refresh and reload command number
Open Table number of tables opened now
Memory in-use memory directly allocated by MYSQLD code (available only if MySQL is compiled with--with-debug)
Max memory used maximum memory allocated directly by MYSQLD code (only available when MySQL is compiled with--with-debug)
Mainly management is not used to use the words directly into the MySQL create table
You can also mysqldmin create database
./***.sql (This is an export or a written statement)