mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	Problem: ``SET PASSWORD FOR foo@localhost'' was written into binary log using double quites: ``SET PASSWORD FOR "foo"@"localhost"...''. If sql_mode was set to ANSI_QUOTES, parser on slave considered "foo" and "localhost" as identifiers instead of strigns constants, so it failed to parse, generated syntax error and slave then stopped. Fix: changing binary log entries to use single quotes: ``SET PASSWORD FOR 'foo'@'localhost'...'' not to depend on ANSI_QUOTES.
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# Test that GRANT and SET PASSWORD are replicated to the slave
 | 
						|
 | 
						|
source include/master-slave.inc;
 | 
						|
 | 
						|
# do not be influenced by other tests.
 | 
						|
connection master;
 | 
						|
delete from mysql.user where user=_binary'rpl_do_grant';
 | 
						|
delete from mysql.db where user=_binary'rpl_do_grant';
 | 
						|
flush privileges;
 | 
						|
save_master_pos;
 | 
						|
connection slave;
 | 
						|
sync_with_master;
 | 
						|
# if these DELETE did nothing on the master, we need to do them manually on the
 | 
						|
# slave.
 | 
						|
delete from mysql.user where user=_binary'rpl_ignore_grant';
 | 
						|
delete from mysql.db where user=_binary'rpl_ignore_grant';
 | 
						|
flush privileges;
 | 
						|
 | 
						|
# test replication of GRANT
 | 
						|
connection master;
 | 
						|
grant select on *.* to rpl_do_grant@localhost;
 | 
						|
grant drop on test.* to rpl_do_grant@localhost;
 | 
						|
save_master_pos;
 | 
						|
connection slave;
 | 
						|
sync_with_master;
 | 
						|
show grants for rpl_do_grant@localhost;
 | 
						|
 | 
						|
# test replication of SET PASSWORD
 | 
						|
connection master;
 | 
						|
set password for rpl_do_grant@localhost=password("does it work?");
 | 
						|
save_master_pos;
 | 
						|
connection slave;
 | 
						|
sync_with_master;
 | 
						|
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
 | 
						|
 | 
						|
#
 | 
						|
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
 | 
						|
#
 | 
						|
connection master;
 | 
						|
update mysql.user set password='' where user='rpl_do_grant';
 | 
						|
flush privileges;
 | 
						|
select password<>'' from mysql.user where user='rpl_do_grant';
 | 
						|
set sql_mode='ANSI_QUOTES';
 | 
						|
set password for rpl_do_grant@localhost=password('does it work?');
 | 
						|
set sql_mode='';
 | 
						|
save_master_pos;
 | 
						|
connection slave;
 | 
						|
sync_with_master;
 | 
						|
select password<>'' from mysql.user where user='rpl_do_grant';
 | 
						|
 | 
						|
 | 
						|
# clear what we have done, to not influence other tests.
 | 
						|
connection master;
 | 
						|
delete from mysql.user where user=_binary'rpl_do_grant';
 | 
						|
delete from mysql.db where user=_binary'rpl_do_grant';
 | 
						|
flush privileges;
 | 
						|
save_master_pos;
 | 
						|
connection slave;
 | 
						|
sync_with_master;
 | 
						|
# no need to delete manually, as the DELETEs must have done some real job on
 | 
						|
# master (updated binlog)
 | 
						|
flush privileges;
 | 
						|
 | 
						|
# End of 4.1 tests
 |