Mysql – Will changing a MySQL user’s password break existing connections

authenticationMySQLmysql-5.5replication

If I update a user's password or privileges in MySQL, how does this affect existing connections? In particular, if I change the replication user password, will it break replication for connected slaves?

Edit: Assume I am using FLUSH PRIVILEGES after updating the information.

Best Answer

According to MySQL 5.0 Certification Study Guide

enter image description here

Page 489 under the subheading says 'Statement Privilege Checking' says:

Each time the server receives a statement from a client, it check's the client's privileges to see whether it is allowed to execute the statement.

Since MySQL grants are checked in memory, then one of two things must happen

SCENARIO #1

If you ran standard GRANT commands to change the password, the password change is recording on disk via FLUSH PRIVILEGES; automatically. (See Section 34.1.2 "The Grant Tables")

SCENARIO #2

If you hacked the password in, as follows (shown in Section 35.5.1 Page 498):

SET @newpass = PASSWORD('whateverpasswordiwant');
UPDATE mysql.user SET PASSWORD = @newpass WHERE user='replication_user';

This stores the password on disk but does not push it into the in-memory copy of the MySQL Grants. As long as you don't run FLUSH PRIVILEGES; or restart mysqld, you have a chance to change it back. Newer versions of MySQL 5.5 may not be as forgiving.

SHORT ANSWER : For SCENARIO #1, Yes, for SCENARIO #2, more than likely.