Home > Article > Backend Development > How experts check and tune mysql performance (1/6)_PHP tutorial
I have been using the mysql tutorial database tutorial software. It works relatively stably and is very efficient. When encountering serious performance problems, there are generally several possibilities:
1. The index is not built;
2. The SQL writing method is too complicated;
3. Configuration error;
4. The machine really cannot bear the load;
1. The index is not established
If you see that mysql consumes a lot of CPU, you can use the mysql client tool to check it.
Execute under linux
/usr/local/mysql/bin/mysql -hlocalhost -uroot -p
Enter the password. If there is no password, you can enter the client interface without the -p parameter.
Look at the current operation
show full processlist
You can run it several times
This command can see the sql statement currently being executed. It will inform the executed sql, database name, execution status, client IP, account used, running time and other information
In my cache backend, most of the time there is no SQL statement displayed. I think this is normal. If you see a lot of sql statements, then this mysql must have performance problems 1 2 3 4 5 6