| 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 |
# Restart server with --skip-grant-tables option and new datadir |
| 27 |
# restart: --skip-grant-tables --datadir=MYSQLD_DATADIR1 |
| 28 |
|
| 29 |
# connect the root user which uses the default auth plugin |
| 30 |
connection_type |
| 31 |
Socket |
| 32 |
current_user |
| 33 |
skip-grants user@skip-grants host |
| 34 |
|
| 35 |
# connect the native_user plugin user which uses the default auth plugin |
| 36 |
connection_type |
| 37 |
Socket |
| 38 |
current_user |
| 39 |
skip-grants user@skip-grants host |
| 40 |
|
| 41 |
# connect the root user which uses the non-default auth plugin |
| 42 |
connection_type |
| 43 |
Socket |
| 44 |
current_user |
| 45 |
skip-grants user@skip-grants host |
| 46 |
|
| 47 |
# connect the native user plugin user which uses corresponding plugin |
| 48 |
connection_type |
| 49 |
Socket |
| 50 |
current_user |
| 51 |
skip-grants user@skip-grants host |
| 52 |
|
| 53 |
# Cleanup |
| 54 |
# restart |