Created
July 4, 2013 01:56
-
-
Save pantoniotti/5924342 to your computer and use it in GitHub Desktop.
MySql Code snippets
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
| ### Create New User | |
| $mysql -u root -p | |
| CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; | |
| GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; | |
| ### Create New Database | |
| $mysql -u root -p | |
| mysql> CREATE DATABASE testing; | |
| mysql> GRANT ALL PRIVILEGES ON testing.* TO test_user@localhost IDENTIFIED BY 'test_pass'; | |
| ### Update or change password | |
| MySQL stores usernames and passwords in the user table inside the MySQL database. You can directly update a password using the following method to update or change passwords: | |
| $ mysql -u root -p | |
| mysql> use mysql; | |
| mysql> update user set password=PASSWORD("newpass") where User='ENTER-USER-NAME-HERE'; | |
| mysql> flush privileges; | |
| mysql> quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment