set @old_max_password_errors=@@max_password_errors;
set global max_password_errors=2;
create user u identified by 'good_pass';
connect(localhost,u,bas_pass,test,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, u, bas_pass;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
connect  con1, localhost, u, bad_pass;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
connect(localhost,u,good_pass,test,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, u, good_pass;
ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, u, bad_pass;
ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
FLUSH PRIVILEGES;
connect  con1, localhost, u, good_pass;
disconnect con1;
connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
connect  con1, localhost, u, bad_pass;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
connect  con1, localhost, u, good_pass;
disconnect con1;
connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
connect  con1, localhost, u, bad_pass;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
connect  con1, localhost, u, good_pass;
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES)
ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES'
disconnect con1;
connection default;
FLUSH PRIVILEGES;
connect(localhost,root,bas_pass,test,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, root, bas_pass;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,bad_pass,test,MASTER_PORT,MASTER_SOCKET);
connect  con1, localhost, root, bad_pass;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect  con1, localhost, u, good_pass;
disconnect con1;
connection default;
DROP USER u;
FLUSH PRIVILEGES;
set global max_password_errors=@old_max_password_errors;
