1. Check the database performance:
Show status;
Select a few more important parameters
2. AWK simple script programming to implement database performance statistics 1. Create a new Vi score.txt
2 .Write the following data:
3. Refresh once every second and write to a file for analysis
3. Introduction to AWK syntax
Awk
is a simple literal text processing The tool. is good at processing --data with multiple rows and columns. Processing process
:While(
There is also the next row) {1:
Read the next row,and assign the next row to $0,each column Assign to $1,$2...$Nvariable 2:
Use the specified command to process the line}
How to process
1line data?Answer
:points2part, pattern (condition) + action(processing action)The 1st simple
awk scriptawk '{printf "%sn" , $1}' xx.txt // Output each line of
xx.txtth 2
A simple awkscript statisticsmysql Server informationmysqladmin -uroot ext|awk 'Queries/{q=$4}/Threads_connected/{c=$4}/Threads_running/{r=$4}END{printf("%d %d %dn" ,q,c,r)}'
The above introduces the Mysql database optimization series (2)------AWK script statistics database performance parameters, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.