I frequently need to do the following things in MySQL:
- Create a non-root user
- Set that user's password
- Grant that user all privileges
- Make a database with the same name as the new user
- Allow usage only for users from the
localhost
.
Previously I did this using PHPmyadmin, but I would prefer doing it directly from BASH. Is there a CLI way to execute these steps?