In this tutorial you will learn how to create and drop users in MySQL.
Code used during this tutorial:
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 |
# Create a new user and grant permissions in MySQL # Delete MySQL user # Connect to MySQL using "root" user mysql -uroot -ppasswd # Make a new user CREATE USER 'usr'@'localhost' IDENTIFIED BY 'usr-passwd'; # Allow the user to read, edit, execute and perform all tasks across all the databases and tables GRANT ALL PRIVILEGES ON * . * TO 'usr'@'localhost'; # Reload all the privileges FLUSH PRIVILEGES; # Connect to MySQL using the new user mysql -uusr -pusr-passwd # Connect to MySQL using "root" user mysql -uroot -ppasswd # Test with MySQL Workbench # Delete user DROP USER 'usr'@'localhost'; # Connect to MySQL using "usr" user mysql -uusr -pusr-passwd Useful links: https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql |
Useful links:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql