I don't know if you can understand the phrase "Hot password change" in the database. It means hot plugging (I don't know how to describe it... in other words, when the website is running, changing the database password will not cause password errors or other errors. My blog (Typecho) has a low access volume... I wonder if you can understand it.
Hot modification of Database Password
This phrase means
Hot plugging
Of
Hot
(I don't know how to describe it.), that is
Change the Database Password while the website is running, without errors such as password errors.
My blog (Typecho) has a very low access volume. If you change the database password, you don't have to worry about an error, because in just over a dozen seconds (Modification on the Host Control Panel) the probability of human access is quite low. I guess this is the case for many people/many small websites. If the traffic volume is a little large, it can be done in the dead of night.
So the question is: How should a website with a large traffic volume (such as SF or something) Hot change the Database Password?
One of the solutions I suddenly came up with when I was writing this question was
In the configuration file, write the Database Password as an array and save two or more passwords. IfPassword 1
If an error is reportedPassword 2
.
Before changing the password, change the password that is invalid in the configuration file to the new password to be modified, and then change the Database Password. In this way, the new password and old password can coexist for seamless switching.
However, I feel that the efficiency will be reduced. When I do not change the password at ordinary times, I have to make a judgment every time I connect to the database...
P.S. Don't be limited to the solution I think of. Hello (I feel that if I leave a solution for each question, many people will follow my ideas to improve it). In this regardNo experienceYes !!
Reply content:
I wonder if you can understand it.Hot modification of Database Password
This phrase meansHot plugging
OfHot
(I don't know how to describe it.), that isChange the Database Password while the website is running, without errors such as password errors.
My blog (Typecho) has a very low access volume. If you change the database password, you don't have to worry about an error, because in just over a dozen seconds (Modification on the Host Control Panel) the probability of human access is quite low. I guess this is the case for many people/many small websites. If the traffic volume is a little large, it can be done in the dead of night.
So the question is: How should a website with a large traffic volume (such as SF or something) Hot change the Database Password?
One of the solutions I suddenly came up with when I was writing this question was
In the configuration file, write the Database Password as an array and save two or more passwords. IfPassword 1
If an error is reportedPassword 2
.
Before changing the password, change the password that is invalid in the configuration file to the new password to be modified, and then change the Database Password. In this way, the new password and old password can coexist for seamless switching.
However, I feel that the efficiency will be reduced. When I do not change the password at ordinary times, I have to make a judgment every time I connect to the database...
P.S. Don't be limited to the solution I think of. Hello (I feel that if I leave a solution for each question, many people will follow my ideas to improve it). In this regardNo experienceYes !!
Well, let's look at a small chestnut. The password expiration problem is handled by exception. To put it bluntly, you can try again. When the password configuration is re-issued, the new connection will use the new configuration, and the old connection will be destroyed after an exception occurs, because it is a connection managed by the connection pool, so there is no need to create a new one. It is much more lazy and simple:>.
In fact, in the Mysql protocol, the password becomes invalid after the connection is established.ERROR 1820
(In fact, the user is invalid.) You can useSET PASSWORD
Make changes. Therefore, the subject is worried about not having to worry about it. Wait for an exception to be thrown and try again by changing the password of the current connection in the exception.