Created
January 29, 2025 13:09
-
-
Save agvxov/1ce26c10441902786c043c1037eb765f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>since MySQL uses an internal system for identifying users a few hoops must be jumped | |
>root is always preregistered | |
1. Log in as root | |
$ sudo mysql | |
2. Create a new user | |
CREATE USER '<your_name>'@'localhost' IDENTIFIED BY '<password>'; | |
>NOTE: <password> doesnt have to be the same as the user's system login password | |
3. Grant privileges to the new user | |
GRANT ALL PRIVILEGES ON *.* TO '<your_name>'@'localhost'; | |
FLUSH PRIVILEGES; | |
>NOTE: this grants all privileges, which may not be a very bright idea on a shared system; | |
granting partial privileges is recommended and detailed BELOW | |
4. Exit | |
exit | |
5. Log in as yourself | |
mysql --user=<your_username> -p | |
-NOTE: the following alias is recommended (see AT "/Bash/Builtins/alias") | |
alias mysql="mysql --user=${USER} -p" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment