File: mysqladmin.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (169 lines) | stat: -rw-r--r-- 6,733 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# Test "mysqladmin ping"
#

--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1

#
# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
#

# When mysqladmin finds database in .cnf file it shall fail
--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
[client]
database=db1
EOF

# Error 7 is EXIT_UNKNOWN_VARIABLE.
--replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
--error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;

# When mysqladmin finds "loose-database" in .cnf file it shall print
# a warning and continue
--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
[client]
loose-database=db2
EOF

--replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root --password= ping 2>&1

remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf;

#
# WL#3126 TCP address binding for mysql client library;
# - running mysqladmin --protcol=tcp --bind-address=127.0.0.1
#
--exec $MYSQLADMIN --no-defaults --protocol=tcp --bind-address=127.0.0.1 --host=127.0.0.1 -P $MASTER_MYPORT -u root ping 2>&1
--echo #
--echo # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
--echo #

--echo # Executing mysqladmin with --sleep=1 and --count=2.
--exec $MYSQLADMIN --no-defaults -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 ping > $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
--echo # Done.
--echo # Displaying the output :
--cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp

--remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp

--echo #
--echo # BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
--echo #                with no .cnf or .ini extension.
--echo #

--echo # Creating an empty file 'cnf_file'
--write_file $MYSQLTEST_VARDIR/tmp/cnf_file
EOF

--echo # Using --defaults-extra-file option with 'cnf_file'.
--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1

# Testing with non-empty --defaults-extra-file with .cnf extension.
--write_file $MYSQLTEST_VARDIR/tmp/cnf_test.cnf
[client]
host = 127.0.0.1
EOF

--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_test.cnf -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1

--remove_file $MYSQLTEST_VARDIR/tmp/cnf_test.cnf

# Uncomment the following scenarios after Bug#27406735 is fixed
# Testing with non-existing defaults-extra-file
#--error 1
#--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/nonexistent.cnf -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT ping < /dev/null > /dev/null 2>&1

# Testing with non-existing defaults-file
#--error 1
#--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/nonexistent.cnf -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --show-warnings ping < /dev/null > /dev/null  2>&1

# Testing defaults-file with with no .cnf or .ini extension
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --show-warnings ping 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file

# Testing with non-empty --defaults-file with .cnf extension
--write_file $MYSQLTEST_VARDIR/tmp/cnf_test_df.cnf
[client]
host = 127.0.0.1
EOF

--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/cnf_test_df.cnf -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/cnf_test_df.cnf

# Using option relative
--exec $MYSQLADMIN -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 extended status < /dev/null > /dev/null  2>&1

# Running mysqladmin with --compress
--exec $MYSQLADMIN -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --compress --skip-verbose ping 2>&1

# Testing option --login-path
CREATE USER testadmin_user1;
FLUSH PRIVILEGES;
--exec $MYSQL_CONFIG_EDITOR set --login-path=test-login-path1 --user=testadmin_user1 --host=127.0.0.1 2>&1
--exec $MYSQLADMIN --no-defaults --login-path=test-login-path1 --port=$MASTER_MYPORT ping 2>&1
DROP USER testadmin_user1;
--remove_file $MYSQL_TEST_LOGIN_FILE

# Using --server-public-key-path and --get-server-public-key
CREATE USER tester@localhost IDENTIFIED WITH caching_sha2_password BY 'abcd';
--exec $MYSQLADMIN --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=DISABLED -utester -pabcd --server-public-key-path=$MYSQL_TEST_DIR/std_data/rsa_public_key.pem ping
--exec $MYSQLADMIN --host=127.0.0.1 -P $MASTER_MYPORT --ssl-mode=DISABLED -utester -pabcd --get-server-public-key ping
DROP USER tester@localhost;

--echo #
--echo # Bug#12688860 : SECURITY RECOMMENDATION: PASSWORDS ON CLI
--echo #

--exec $MYSQLADMIN --no-defaults -uroot --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1


--echo #
--echo # Bug#21796658: OLD-PASSWORD SUBCOMMAND IS STILL IN MYSQLADMIN --HELP IN 5.7
--echo #

--let $admin_outfile=$MYSQLTEST_VARDIR/tmp/bug21796658.output

--echo # execute mysqladmin --help
# Returns 1 on normal execution
--error 1
--exec $MYSQLADMIN --help 2>&1 > $admin_outfile

--echo # check the output of mysqladmin for old-password
--let $assert_text= check the output of mysqladmin for old-password
--let $assert_file= $admin_outfile
--let $assert_select=old-password
--let $assert_count=0
--source include/assert_grep.inc

--echo # cleanup
--remove_file $admin_outfile


--echo #
--echo # Bug #32798288: MORE MEANINFUL MESSAGE FOR MISSING INCLUDE DIRECTORY
--echo #
let $file = $MYSQLTEST_VARDIR/tmp/b32092739.out;
write_file $file;
!includedir /nonexistent
EOF
let $file2 = $MYSQLTEST_VARDIR/tmp/b32092739_file.out;
write_file $file2;
!include /nonexistent
EOF
--replace_regex /OS errno.*/OS error/
--replace_result $file file
--error 1
exec $MYSQLADMIN --defaults-file=$file -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --show-warnings ping 2>&1 ;
# On windows we skip permission check for configs. Hence (on unix) we need to
# replace the my_stat error with a simulated my_open (on windows) error.
--replace_regex /OS errno.*/OS error/ /Can.t get stat of ..nonexistent./File '\\nonexistent' not found/
--replace_result $file2 file2
exec $MYSQLADMIN --defaults-file=$file2 -uroot -h localhost --password="" -S $MASTER_MYSOCK -P $MASTER_MYPORT --show-warnings ping 2>&1 ;
remove_file $file;
remove_file $file2;


--echo End of tests