1 2-- source include/not_embedded.inc 3 4--echo # 5--echo # Testing mysql_config_editor utility. 6--echo # 7 8# Note : a) mtr sets the 'MYSQL_TEST_LOGIN_FILE' environment 9# variable to "$opt_tmpdir/.mylogin.cnf". 10# b) The --password option in not tested as its 11# value cannot be specified at command line. 12 13--echo ################################################ 14--echo # Tests for mysql_config_editor's insert command 15--echo ################################################ 16--echo # 17--echo # Default login path (client) 18--exec $MYSQL_CONFIG_EDITOR set --user=test_user1 --host=localhost 19--echo # done.. 20--echo # 'test-login-path1' 21--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path1 --user=test_user2 --host=127.0.0.1 22--echo # done.. 23--echo # 'test-login-path2' 24--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path2 --user=test_user3 --host=www.mysql.com 25--echo # done.. 26--echo # 'test-login-path3' 27--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path3 --user=test_user4 --host=127.0.0.1 --socket=/tmp/configtest.sock --port=15000 28--echo # done.. 29 30--echo 31--echo ################################################ 32--echo # Tests for mysql_config_editor's print command 33--echo ################################################ 34--echo # 35--echo # Default path 36--exec $MYSQL_CONFIG_EDITOR print 2>&1 37--echo 38--echo # 39--echo # test-login-path1 40--exec $MYSQL_CONFIG_EDITOR print --login-path=test-login-path1 2>&1 41--echo 42--echo # 43--echo # test-login-path2 44--exec $MYSQL_CONFIG_EDITOR print --login-path=test-login-path2 2>&1 45--echo 46--echo # 47--echo # all the paths 48--exec $MYSQL_CONFIG_EDITOR print --all 2>&1 49--echo 50--echo # 51--echo # Overwrite existing paths, test-login-path2 & default 52--exec $MYSQL_CONFIG_EDITOR set --user=test_user4 --login-path=test-login-path2 --skip-warn 53--exec $MYSQL_CONFIG_EDITOR set --user=test_user5 --skip-warn 54--echo # 55--echo # all the paths again 56--exec $MYSQL_CONFIG_EDITOR print --all 2>&1 57 58--echo 59--echo ################################################ 60--echo # Tests for mysql_config_editor's remove command 61--echo ################################################ 62--echo # 63--echo # Default path 64--exec $MYSQL_CONFIG_EDITOR remove --skip-warn 65--echo # done.. 66--echo # test-login-path1 67--exec $MYSQL_CONFIG_EDITOR remove --login-path=test-login-path1 68--echo # done.. 69--echo # test-login-path3 70--exec $MYSQL_CONFIG_EDITOR remove --login-path=test-login-path3 --socket --port 71--echo # done.. 72 73--echo 74--echo ######################## 75--echo # Printing the leftovers 76--echo ######################## 77--echo # 78--echo # using all 79--exec $MYSQL_CONFIG_EDITOR print --all 80 81--echo 82--echo ############################################### 83--echo # Tests for mysql_config_editor's reset command 84--echo ############################################### 85--exec $MYSQL_CONFIG_EDITOR reset 86--echo # done.. 87--echo # Print-all to check if everything got deleted. 88--exec $MYSQL_CONFIG_EDITOR print --all 89 90--echo 91--echo ############################################## 92--echo # Tests for mysql_config_editor's help command 93--echo ############################################## 94--replace_regex /.*mysql_config_editor.*// /.*Output debug log.*// /.*This is a non.debug version.*// 95--exec $MYSQL_CONFIG_EDITOR help 2>&1 96--echo # done.. 97 98--echo 99--echo ###################### 100--echo # Testing client tools 101--echo ###################### 102--echo # 103--echo # Inserting login paths default & test-login-path1 104--exec $MYSQL_CONFIG_EDITOR --verbose set --user=test_user1 --host=localhost 2>&1 105--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path1 --user=test_user2 --host=127.0.0.1 2>&1 106--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path2 --user=test_user3 --host=127.0.0.1 --socket=/tmp/configtest.sock --port=15000 2>&1 107--echo # done.. 108--echo 109--echo # Connecting using 'test_user1' 110--echo # 111--error 1 112--exec $MYSQL 2>&1 113--echo 114--echo # Connecting using 'test_user2' 115--echo # 116--error 1 117--exec $MYSQL --login-path=test-login-path1 2>&1 118 119--echo # Creating user 'test_user1' 120CREATE USER test_user1; 121--echo # Creating user 'test_user2' 122CREATE USER test_user2; 123FLUSH PRIVILEGES; 124--echo # 125--echo # Now trying to connect again.. 126--echo # Connecting using 'test_user1' 127--echo # 128--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 129--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 130--echo 131--echo # Connecting using 'test_user2' 132--echo # 133--exec $MYSQLADMIN --no-defaults --login-path=test-login-path1 --port=$MASTER_MYPORT ping 2>&1 134--exec $MYSQLADMIN --no-defaults --login-path=test-login-path1 --port=$MASTER_MYPORT ping 2>&1 135 136--echo # 137--echo # Inserting a login path to test group suffix (client_suffix1) 138--exec $MYSQL_CONFIG_EDITOR set --user=test_user3 --login-path=client_suffix1 139--echo 140--echo # Printing all the paths.. 141--exec $MYSQL_CONFIG_EDITOR print --all 2>&1 142--echo 143--echo # Now trying to connect using 'test_user3' 144--echo # Note : In this case options from login 145--echo # paths 'client' (default) and 146--echo # client_suffix1 will be read.. 147--error 1 148--exec $MYSQL --defaults-group-suffix=_suffix1 2>&1 149 150--echo ## Running my_print_defaults ## 151--echo # 152--echo # (a) With --no-defaults option.. 153--echo # It should print the options under the default 154--echo # login path 'client'. 155--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults client 2>&1 156--echo 157--echo # (b) With --no-defaults & --login-path 158--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path1 client 2>&1 159--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path2 client 2>&1 160--echo 161--echo # (c) With --no-defaults & --defaults-group-suffix 162--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --defaults-group-suffix=_suffix1 client 2>&1 163--echo 164--echo # (d) With --no-defaults, --login-path & --defaults-group-suffix 165--exec $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path --defaults-group-suffix=1 client 2>&1 166#--exec xterm -e gdb --args $MYSQL_MY_PRINT_DEFAULTS --no-defaults --login-path=test-login-path --defaults-group-suffix=1 client 2>&1 167 168# Cleanup 169--echo 170--echo # Dropping users 'test_user1' & 'test_user2' 171DROP USER test_user1, test_user2; 172--echo 173--echo ############################### 174--echo # Resetting the test login file 175--echo ############################### 176--exec $MYSQL_CONFIG_EDITOR reset 177--echo # done.. 178 179--echo 180--echo #################################### 181--echo # Testing with an invalid login file 182--echo #################################### 183--remove_file $MYSQL_TEST_LOGIN_FILE 184--copy_file std_data/.mylogin.cnf $MYSQL_TEST_LOGIN_FILE 185--cat_file $MYSQL_TEST_LOGIN_FILE 186 187--echo # The 'invalid' login file should not cause 188--echo # any problem. 189--echo # 190--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2> /dev/null 191 192--echo ############################### 193--echo # Dropping the test login file 194--echo ############################### 195--remove_file $MYSQL_TEST_LOGIN_FILE 196--echo 197--echo ################################# 198--echo # Testing with login file removed 199--echo ################################# 200--echo # Even if login file does not exist, the 201--echo # tools should be able to continue 202--echo # normally. 203--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2>&1 204 205--echo 206--echo ###################### 207--echo # WL#2284 Testing client tools with 32 user name 208--echo ###################### 209--echo # 210--echo # Inserting login paths default & test-login-path_user_26 211--exec $MYSQL_CONFIG_EDITOR --verbose set --user=user_name_len_25_01234567 --host=localhost 2>&1 212--exec $MYSQL_CONFIG_EDITOR --verbose set --login-path=test-login-path_user_26 --user=user_name_len_26_012345678 --host=127.0.0.1 2>&1 213--echo # done.. 214--echo 215--echo # Creating users for login 216CREATE USER user_name_len_25_01234567@localhost; 217CREATE USER user_name_len_26_012345678@localhost; 218 219--echo # Connecting using 'user_name_len_25_01234567' 220--echo # 221--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 222--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 223--echo 224--echo # Connecting using 'user_name_len_26_012345678' 225--echo # 226--exec $MYSQLADMIN --no-defaults --login-path=test-login-path_user_26 --port=$MASTER_MYPORT ping 2>&1 227--exec $MYSQLADMIN --no-defaults --login-path=test-login-path_user_26 --port=$MASTER_MYPORT ping 2>&1 228 229# Cleanup 230--echo 231--echo # Dropping users 'user_name_len_25_01234567@localhost' & 'CREATE USER user_name_len_26_012345678@localhost' 232DROP USER user_name_len_25_01234567@localhost,user_name_len_26_012345678@localhost; 233--echo 234--echo ############################### 235--echo # Resetting the test login file 236--echo ############################### 237--exec $MYSQL_CONFIG_EDITOR reset 238--echo # done.. 239 240 241--echo #### End of test #### 242 243 244--echo # 245--echo # Bug #24557925: MYSQL_CONFIG_EDITOR CAN MAKE SERVER UNBOOTABLE 246--echo # 247 248 249--exec $MYSQL_CONFIG_EDITOR set --login-path=mysqld --host=test_user5 250 251--echo # Restarting the server. Should work 252--source include/restart_mysqld.inc 253 254--echo # Cleanup 255--exec $MYSQL_CONFIG_EDITOR remove --login-path=mysqld 256--remove_file $MYSQL_TEST_LOGIN_FILE 257 258--echo # 259--echo # Bug#29861961: MYSQL_CONFIG_EDITOR CAN NOT DEAL PASSWORD WITH "#" 260--echo # 261 262CREATE USER 'test#user1'@'localhost'; 263--exec $MYSQL_CONFIG_EDITOR set --login-path=test --user=test#user1 --host=127.0.0.1 2>&1 264 265--exec $MYSQLADMIN --no-defaults --login-path=test --port=$MASTER_MYPORT ping 2>&1 266 267--echo # Cleanup 268DROP USER 'test#user1'@'localhost'; 269--exec $MYSQL_CONFIG_EDITOR remove --login-path=test 270--remove_file $MYSQL_TEST_LOGIN_FILE 271 272--echo # End of 5.6 tests 273