In MySQL configuration file my.cnf, there is a one-line skip-external-locking parameter, which is "Skip external lock". According to the official explanation of the MySQL development website, external-locking is used for locking MyISAM data tables under multi-process conditions.
If you have more than one server using the same database directory (not recommended), then each server must turn on external locking;
Parameter interpretation
When external locking (external-locking) is in effect, each process to access the data table must wait for the previous process to finish and unlock. Because servers often need to wait to unlock data tables, external locking in a single-server environment can degrade MySQL performance. So in the source of many Linux distributions, skip-external-locking is used by default in the MySQL configuration file to avoid external locking.
When skip-external-locking is used, in order to use MYISAMCHK to check the database or to repair and optimize the table, you must ensure that the MySQL server does not use the tables that need to be manipulated during this process. If you do not stop the server, you must run it at least first
1 |
mysqladmin flush-tables |
command, otherwise the data table may appear to be abnormal.
Parameter usage Instructions
If you are a multi-server environment and want to open the external locking feature, comment out this line
1 |
# skip-external-locking |
If it is a single-server environment, disable it and use the following statement
Precautions
In the old version of MySQL, this parameter is written as:
If you still use this notation in the new version of MySQL configuration, it may appear:
[Warning] ' –skip-locking ' is deprecated and would be removed in a future release. Please use ' –skip-external-locking ' instead.