Created
September 20, 2012 11:04
-
-
Save lajlev/3755246 to your computer and use it in GitHub Desktop.
Create user and grant access to mysql database
This file contains 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
/* Login from terminal */ | |
mysql -u USERNAME -p DATABASENAME; | |
/* Simple commands */ | |
create database DATABASENAME; | |
show databases; | |
use DATABASENAME; | |
/* Create a user and grant access to database */ | |
grant all privileges on DATABASENAME.* | |
to 'USERNAME'@'localhost' | |
identified by 'PASSWORD'; | |
/* Change user password */ | |
SET PASSWORD FOR 'USERNAME'@'localhost' = PASSWORD('NEWPASSWORD'); | |
/* Show grants */ | |
show grants for 'USERNAME'@'localhost'; | |
/* Links */ | |
http://cse.unl.edu/~sscott/ShowFiles/SQL/CheatSheet/SQLCheatSheet.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment