|
| 1 | +install soname 'auth_socket'; |
| 2 | +install soname 'auth_ed25519'; |
| 3 | +create user USER identified via unix_socket OR mysql_native_password as password("GOOD"); |
| 4 | +create user mysqltest1 identified via unix_socket OR mysql_native_password as password("good"); |
| 5 | +show create user mysqltest1; |
| 6 | +CREATE USER for mysqltest1@% |
| 7 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA unix_socket OR mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' |
| 8 | +# name match = ok |
| 9 | +select user(), current_user(), database(); |
| 10 | +user() current_user() database() |
| 11 | +USER@localhost USER@% test |
| 12 | +# name does not match, password good = ok |
| 13 | +select user(), current_user(), database(); |
| 14 | +user() current_user() database() |
| 15 | +mysqltest1@localhost mysqltest1@% test |
| 16 | +# name does not match, password bad = failure |
| 17 | +drop user USER, mysqltest1; |
| 18 | +create user USER identified via mysql_native_password as password("GOOD") OR unix_socket; |
| 19 | +create user mysqltest1 identified via mysql_native_password as password("good") OR unix_socket; |
| 20 | +show create user mysqltest1; |
| 21 | +CREATE USER for mysqltest1@% |
| 22 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' OR unix_socket |
| 23 | +# name match = ok |
| 24 | +select user(), current_user(), database(); |
| 25 | +user() current_user() database() |
| 26 | +USER@localhost USER@% test |
| 27 | +# name does not match, password good = ok |
| 28 | +select user(), current_user(), database(); |
| 29 | +user() current_user() database() |
| 30 | +mysqltest1@localhost mysqltest1@% test |
| 31 | +# name does not match, password bad = failure |
| 32 | +drop user USER, mysqltest1; |
| 33 | +create user USER identified via unix_socket OR ed25519 as password("GOOD"); |
| 34 | +create user mysqltest1 identified via unix_socket OR ed25519 as password("good"); |
| 35 | +show create user mysqltest1; |
| 36 | +CREATE USER for mysqltest1@% |
| 37 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA unix_socket OR ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' |
| 38 | +# name match = ok |
| 39 | +select user(), current_user(), database(); |
| 40 | +user() current_user() database() |
| 41 | +USER@localhost USER@% test |
| 42 | +# name does not match, password good = ok |
| 43 | +select user(), current_user(), database(); |
| 44 | +user() current_user() database() |
| 45 | +mysqltest1@localhost mysqltest1@% test |
| 46 | +# name does not match, password bad = failure |
| 47 | +drop user USER, mysqltest1; |
| 48 | +create user USER identified via ed25519 as password("GOOD") OR unix_socket; |
| 49 | +create user mysqltest1 identified via ed25519 as password("good") OR unix_socket; |
| 50 | +show create user mysqltest1; |
| 51 | +CREATE USER for mysqltest1@% |
| 52 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket |
| 53 | +# name match = ok |
| 54 | +select user(), current_user(), database(); |
| 55 | +user() current_user() database() |
| 56 | +USER@localhost USER@% test |
| 57 | +# name does not match, password good = ok |
| 58 | +select user(), current_user(), database(); |
| 59 | +user() current_user() database() |
| 60 | +mysqltest1@localhost mysqltest1@% test |
| 61 | +# name does not match, password bad = failure |
| 62 | +drop user USER, mysqltest1; |
| 63 | +create user USER identified via ed25519 as password("GOOD") OR unix_socket OR mysql_native_password as password("works"); |
| 64 | +create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); |
| 65 | +show create user mysqltest1; |
| 66 | +CREATE USER for mysqltest1@% |
| 67 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' |
| 68 | +# name match = ok |
| 69 | +select user(), current_user(), database(); |
| 70 | +user() current_user() database() |
| 71 | +USER@localhost USER@% test |
| 72 | +# name does not match, password good = ok |
| 73 | +select user(), current_user(), database(); |
| 74 | +user() current_user() database() |
| 75 | +mysqltest1@localhost mysqltest1@% test |
| 76 | +# name does not match, second password works = ok |
| 77 | +select user(), current_user(), database(); |
| 78 | +user() current_user() database() |
| 79 | +mysqltest1@localhost mysqltest1@% test |
| 80 | +# name does not match, password bad = failure |
| 81 | +drop user USER, mysqltest1; |
| 82 | +create user mysqltest1 identified via mysql_native_password as password("good") OR mysql_native_password as password("works"); |
| 83 | +show create user mysqltest1; |
| 84 | +CREATE USER for mysqltest1@% |
| 85 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA mysql_native_password USING '*8409037B3E362D6DAE24C8E667F4D3B66716144E' OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' |
| 86 | +# password good = ok |
| 87 | +select user(), current_user(), database(); |
| 88 | +user() current_user() database() |
| 89 | +mysqltest1@localhost mysqltest1@% test |
| 90 | +# second password works = ok |
| 91 | +select user(), current_user(), database(); |
| 92 | +user() current_user() database() |
| 93 | +mysqltest1@localhost mysqltest1@% test |
| 94 | +# password bad = failure |
| 95 | +drop user mysqltest1; |
| 96 | +create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); |
| 97 | +show grants for mysqltest1; |
| 98 | +Grants for mysqltest1@% |
| 99 | +GRANT USAGE ON *.* TO 'mysqltest1'@'%' IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' |
| 100 | +select json_detailed(priv) from mysql.global_priv where user='mysqltest1'; |
| 101 | +json_detailed(priv) |
| 102 | +{ |
| 103 | + "access": 0, |
| 104 | + "plugin": "mysql_native_password", |
| 105 | + "authentication_string": "*7D8C3DF236D9163B6C274A9D47704BC496988460", |
| 106 | + "auth_or": |
| 107 | + [ |
| 108 | + |
| 109 | + { |
| 110 | + "plugin": "ed25519", |
| 111 | + "authentication_string": "F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc" |
| 112 | + }, |
| 113 | + |
| 114 | + { |
| 115 | + "plugin": "unix_socket" |
| 116 | + }, |
| 117 | + |
| 118 | + { |
| 119 | + } |
| 120 | + ] |
| 121 | +} |
| 122 | +select password,plugin,authentication_string from mysql.user where user='mysqltest1'; |
| 123 | +Password plugin authentication_string |
| 124 | +*7D8C3DF236D9163B6C274A9D47704BC496988460 mysql_native_password *7D8C3DF236D9163B6C274A9D47704BC496988460 |
| 125 | +flush privileges; |
| 126 | +show create user mysqltest1; |
| 127 | +CREATE USER for mysqltest1@% |
| 128 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA ed25519 USING 'F4aF8bw7130VaRbdLCl4f/P/wkjDmgJXwWvpJ5gmsZc' OR unix_socket OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' |
| 129 | +set password for mysqltest1 = password('foobar'); |
| 130 | +show create user mysqltest1; |
| 131 | +CREATE USER for mysqltest1@% |
| 132 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA ed25519 USING 'qv2mG6HWCuy32Slb5xhV4THStewNz2VINVPbgk+XAJ8' OR unix_socket OR mysql_native_password USING '*7D8C3DF236D9163B6C274A9D47704BC496988460' |
| 133 | +alter user mysqltest1 identified via unix_socket OR mysql_native_password as password("some"); |
| 134 | +show create user mysqltest1; |
| 135 | +CREATE USER for mysqltest1@% |
| 136 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' |
| 137 | +set password for mysqltest1 = password('foobar'); |
| 138 | +show create user mysqltest1; |
| 139 | +CREATE USER for mysqltest1@% |
| 140 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5' |
| 141 | +alter user mysqltest1 identified via unix_socket; |
| 142 | +set password for mysqltest1 = password('bla'); |
| 143 | +ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin |
| 144 | +alter user mysqltest1 identified via mysql_native_password as password("some") or unix_socket; |
| 145 | +show create user mysqltest1; |
| 146 | +CREATE USER for mysqltest1@% |
| 147 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' OR unix_socket |
| 148 | +drop user mysqltest1; |
| 149 | +create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); |
| 150 | +ERROR HY000: Column count of mysql.user is wrong. Expected 3, found 47. Created with MariaDB XX.YY.ZZ, now running XX.YY.ZZ. Please use mysql_upgrade to fix this error |
| 151 | +create user USER identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; |
| 152 | +create user mysqltest1 identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; |
| 153 | +update mysql.global_priv set priv=replace(priv, '1234567890123456789012345678901234567890a', 'invalid password'); |
| 154 | +flush privileges; |
| 155 | +show create user mysqltest1; |
| 156 | +CREATE USER for mysqltest1@% |
| 157 | +CREATE USER 'mysqltest1'@'%' IDENTIFIED VIA mysql_native_password USING 'invalid password' OR unix_socket |
| 158 | +# name match = ok |
| 159 | +select user(), current_user(), database(); |
| 160 | +user() current_user() database() |
| 161 | +USER@localhost USER@% test |
| 162 | +# name does not match = failure |
| 163 | +# SET PASSWORD helps |
| 164 | +set password for mysqltest1 = password('bla'); |
| 165 | +select user(), current_user(), database(); |
| 166 | +user() current_user() database() |
| 167 | +mysqltest1@localhost mysqltest1@% test |
| 168 | +drop user USER, mysqltest1; |
| 169 | +uninstall soname 'auth_socket'; |
| 170 | +uninstall soname 'auth_ed25519'; |
0 commit comments