I was in a meeting when a colleague called to report that the development library could not be written. The error message was as follows: 1209 - The MySQL server is running with the --read-only option so it cannot execute this statement Generally, there are two reasons for this error: 1. Connect to the slave database. The slave library is generally set to read-only. 2. The read_only parameter of the master database is changed to 1 Developers are ordinary users and should not have permission to modify the value of this parameter. The DBA will not actively modify this parameter. So what exactly is the reason why the development library cannot be written? First, we confirmed that the problem was not with the developers, because more than 200 R&D personnel in the department encountered this problem. To solve the problem first, query the value of the read_only parameter on the master database. Sure enough, read_only is set to 1. After manually changing it to 0, the problem is solved. The question is why is read_only set to 1? The solution steps are as follows:
Checking the mysql error log, I found the following information: 151231 13:55:11 mysqld_safe Number of processes running now: 0 151231 13:55:11 mysqld_safe mysqldrestarted This shows that MySQL has been restarted. What is the reason for the restart? I checked the system log and found the following error:
From this error, we can see that MySQL restarted due to memory overflow. Out of memory: Kill process 12805 (mysqld)score 964 or sacrifice child So what caused the memory leak? After checking the system's historical commands, I found that a colleague was doing a backup. The system was under great pressure at the time, and the secondary system did not have a swap partition set up. The above reasons led to the restart of MySQL. Swap: 0 0 0 Why does restarting result in read_only=1? Maybe read_only is set in the configuration file. Check the configuration file.
At this time, the reason why the development environment suddenly could not be written was finally revealed. You may ask why the main library sets read_only=on, because it was originally a MMM environment. Now that the MMM environment has been removed, set read_only in the configuration file to 0. The problem of the development library not being able to be written is now solved. MySQL reports an error: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement, etc. 1. Log in to mysql: mysql –u root –p mysql> set global read_only=0; flush privileges; 2. Modify the MySQL configuration file my.cnf, which is in the /etc directory Restart the mysql service: service mysqld restart ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe This error was reported when resetting the password during the installation of MySQL 8.0.3. The reason is that if the password is not set, you need to add this section to /etc/my.cnf to operate mysql #Skip password verification
But after adding this sentence, MySQL reported this error again, which became an infinite loop. Finally, I found a solution. This is because the permissions have been set but not refreshed. Execute first
Execute the SQL statement again and it succeeds ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your password'; You may also be interested in:
|
<<: Ubuntu 20.04 connects to wifi (2 methods)
>>: Detailed explanation of JavaScript upload file limit parameter case
A reader contacted me and asked why there were pr...
Table of contents Brief Analysis of MySQL Master-...
Written in front Sometimes you need to install so...
Well, you may be a design guru, or maybe that'...
Table of contents 1. How are structures stored in...
I searched for many ways to change it online but ...
Preface Docker has been very popular in the past ...
This article will introduce how to save IP addres...
1 The select tag must be closed <select><...
Starting from MySQL 5.7, many security updates ha...
Methods for changing passwords before MySQL 5.7: ...
Today I saw a case study on MySQL IN subquery opt...
Encryption and decryption are an important means ...
Horizontal Line Use the <hr /> tag to draw ...
The use of computed in vue3. Since vue3 is compat...