|
| 1 | +--source include/have_plugin_auth.inc |
| 2 | +--source include/not_embedded.inc |
| 3 | +--source include/master-slave.inc |
| 4 | + |
| 5 | +# |
| 6 | +# Check that replication slave can connect to master using an account |
| 7 | +# which authenticates with an external authentication plugin (bug#12897501). |
| 8 | + |
| 9 | +# |
| 10 | +# First stop the slave to guarantee that nothing is replicated. |
| 11 | +# |
| 12 | +--connection slave |
| 13 | +--echo [connection slave] |
| 14 | +--source include/stop_slave.inc |
| 15 | +# |
| 16 | +# Create an replication account on the master. |
| 17 | +# |
| 18 | +--connection master |
| 19 | +--echo [connection master] |
| 20 | +CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user'; |
| 21 | +GRANT REPLICATION SLAVE ON *.* TO plug_user; |
| 22 | +FLUSH PRIVILEGES; |
| 23 | + |
| 24 | +# |
| 25 | +# Now go to slave and change the replication user. |
| 26 | +# |
| 27 | +--connection slave |
| 28 | +--echo [connection slave] |
| 29 | +--let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1) |
| 30 | +CHANGE MASTER TO MASTER_USER= 'plug_user'; |
| 31 | + |
| 32 | +# |
| 33 | +# Start slave with new replication account - this should trigger connection |
| 34 | +# to the master server. |
| 35 | +# |
| 36 | +--source include/start_slave.inc |
| 37 | + |
| 38 | +# Replicate all statements executed on master, in this case, |
| 39 | +# (creation of the plug_user account). |
| 40 | +# |
| 41 | +--connection master |
| 42 | +--sync_slave_with_master |
| 43 | +--echo # Slave in-sync with master now. |
| 44 | + |
| 45 | +SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; |
| 46 | + |
| 47 | +# |
| 48 | +# Now we can stop the slave and clean up. |
| 49 | +# |
| 50 | +# Note: it is important that slave is stopped at this |
| 51 | +# moment - otherwise master's cleanup statements |
| 52 | +# would be replicated on slave! |
| 53 | +# |
| 54 | +--echo # Cleanup (on slave). |
| 55 | +--source include/stop_slave.inc |
| 56 | +eval CHANGE MASTER TO MASTER_USER='$master_user'; |
| 57 | +DROP USER 'plug_user'; |
| 58 | + |
| 59 | +--echo # Cleanup (on master). |
| 60 | +--connection master |
| 61 | +DROP USER 'plug_user'; |
| 62 | + |
| 63 | +--let $rpl_only_running_threads= 1 |
| 64 | +--source include/rpl_end.inc |
0 commit comments