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
|
# Set different paths for --datadir
# Create custom datadir path
# Run the bootstrap command to create a new datadir
# Start the DB server with the new datadir
# restart: --datadir=MYSQLD_DATADIR1
SELECT current_user;
current_user
root@localhost
SELECT user, plugin FROM mysql.user;
user plugin
mysql.infoschema caching_sha2_password
mysql.session caching_sha2_password
mysql.sys caching_sha2_password
root caching_sha2_password
# Set the password for the root user
SET PASSWORD = 'passwd';
# Create a new user with non-default plugin
CREATE USER 'native_user' IDENTIFIED WITH 'mysql_native_password' BY 'passwd';
# Restart the server with --skip-grant-tables, --shared-memory options
# enabled and new datadir
# restart: --skip-grant-tables --shared-memory --datadir=MYSQLD_DATADIR1
# connect the root user which uses the default auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Shared Memory
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the root user which uses the mysql_native_password auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Shared Memory
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the user which uses the non-default auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Shared Memory
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the native_user user which uses corresponding
# mysql_native_password auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Shared Memory
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# Restart the server with --skip-grant-tables, --enable-named-pipe
# options enabled and new datadir
# restart: --skip-grant-tables --enable-named-pipe --datadir=MYSQLD_DATADIR1
# connect the root user which uses the default auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Named Pipe
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the root user which uses the mysql_native_password auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Named Pipe
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the user which uses the non-default auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Named Pipe
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# connect the native_user user which uses corresponding
# mysql_native_password auth plugin
SELECT connection_type FROM performance_schema.threads WHERE processlist_command='Query';
connection_type
Named Pipe
SELECT CURRENT_USER;
CURRENT_USER
skip-grants user@skip-grants host
# since we didn't specify server's public keys explicitly,
# following insecure connections must fail with
# error: Authentication requires secure connection.
# connect the root user which uses the default auth plugin
# error 1
# connect the root user which uses the mysql_native_password auth plugin
# error 1
# connect the root user which uses the non-default auth plugin
# error 1
# connect the native user plugin user which uses corresponding plugin
# error 1
# Cleanup
# restart
|