| 1 |
|
| 2 |
# Set different paths for --datadir |
| 3 |
|
| 4 |
# Create custom datadir path |
| 5 |
|
| 6 |
# Run the bootstrap command to create a new datadir |
| 7 |
|
| 8 |
# Start the DB server with the new datadir |
| 9 |
# restart: --datadir=MYSQLD_DATADIR1 |
| 10 |
SELECT current_user; |
| 11 |
current_user |
| 12 |
root@localhost |
| 13 |
SELECT user, plugin FROM mysql.user; |
| 14 |
user plugin |
| 15 |
mysql.infoschema caching_sha2_password |
| 16 |
mysql.session caching_sha2_password |
| 17 |
mysql.sys caching_sha2_password |
| 18 |
root caching_sha2_password |
| 19 |
|
| 20 |
# Set the password for the root user |
| 21 |
SET PASSWORD = 'passwd'; |
| 22 |
|
| 23 |
# Create a new user with non-default plugin |
| 24 |
CREATE USER 'native_user' IDENTIFIED WITH 'mysql_native_password' BY 'passwd'; |
| 25 |
|
| 26 |
|
| 27 |
# Restart the server with --skip-grant-tables, --shared-memory options |
| 28 |
# enabled and new datadir |
| 29 |
# restart: --skip-grant-tables --shared-memory --datadir=MYSQLD_DATADIR1 |
| 30 |
|
| 31 |
# connect the root user which uses the default auth plugin |
| 32 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 33 |
connection_type |
| 34 |
Shared Memory |
| 35 |
SELECT CURRENT_USER; |
| 36 |
CURRENT_USER |
| 37 |
skip-grants user@skip-grants host |
| 38 |
|
| 39 |
# connect the root user which uses the mysql_native_password auth plugin |
| 40 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 41 |
connection_type |
| 42 |
Shared Memory |
| 43 |
SELECT CURRENT_USER; |
| 44 |
CURRENT_USER |
| 45 |
skip-grants user@skip-grants host |
| 46 |
|
| 47 |
# connect the user which uses the non-default auth plugin |
| 48 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 49 |
connection_type |
| 50 |
Shared Memory |
| 51 |
SELECT CURRENT_USER; |
| 52 |
CURRENT_USER |
| 53 |
skip-grants user@skip-grants host |
| 54 |
|
| 55 |
# connect the native_user user which uses corresponding |
| 56 |
# mysql_native_password auth plugin |
| 57 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 58 |
connection_type |
| 59 |
Shared Memory |
| 60 |
SELECT CURRENT_USER; |
| 61 |
CURRENT_USER |
| 62 |
skip-grants user@skip-grants host |
| 63 |
|
| 64 |
# Restart the server with --skip-grant-tables, --enable-named-pipe |
| 65 |
# options enabled and new datadir |
| 66 |
# restart: --skip-grant-tables --enable-named-pipe --datadir=MYSQLD_DATADIR1 |
| 67 |
|
| 68 |
# connect the root user which uses the default auth plugin |
| 69 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 70 |
connection_type |
| 71 |
Named Pipe |
| 72 |
SELECT CURRENT_USER; |
| 73 |
CURRENT_USER |
| 74 |
skip-grants user@skip-grants host |
| 75 |
|
| 76 |
# connect the root user which uses the mysql_native_password auth plugin |
| 77 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 78 |
connection_type |
| 79 |
Named Pipe |
| 80 |
SELECT CURRENT_USER; |
| 81 |
CURRENT_USER |
| 82 |
skip-grants user@skip-grants host |
| 83 |
|
| 84 |
# connect the user which uses the non-default auth plugin |
| 85 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 86 |
connection_type |
| 87 |
Named Pipe |
| 88 |
SELECT CURRENT_USER; |
| 89 |
CURRENT_USER |
| 90 |
skip-grants user@skip-grants host |
| 91 |
|
| 92 |
# connect the native_user user which uses corresponding |
| 93 |
# mysql_native_password auth plugin |
| 94 |
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query'; |
| 95 |
connection_type |
| 96 |
Named Pipe |
| 97 |
SELECT CURRENT_USER; |
| 98 |
CURRENT_USER |
| 99 |
skip-grants user@skip-grants host |
| 100 |
# since we didn't specify server's public keys explicitly, |
| 101 |
# following insecure connections must fail with |
| 102 |
# error: Authentication requires secure connection. |
| 103 |
|
| 104 |
# connect the root user which uses the default auth plugin |
| 105 |
# error 1 |
| 106 |
|
| 107 |
# connect the root user which uses the mysql_native_password auth plugin |
| 108 |
# error 1 |
| 109 |
|
| 110 |
# connect the root user which uses the non-default auth plugin |
| 111 |
# error 1 |
| 112 |
|
| 113 |
# connect the native user plugin user which uses corresponding plugin |
| 114 |
# error 1 |
| 115 |
|
| 116 |
# Cleanup |
| 117 |
# restart |