Last active
July 20, 2018 11:42
-
-
Save ErDmKo/7430412 to your computer and use it in GitHub Desktop.
Sql create new database and create user.
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
CREATE DATABASE <BDname> CHARACTER SET utf8 COLLATE utf8_general_ci; | |
GRANT ALL PRIVILEGES ON <BDname>.* to <user_name>@localhost identified by '<user_password>'; | |
for crone: | |
mysqldump -u <user_name> '-p<user_password>' <oldBDname> | gzip > ~/$(date +/var/sqlDump/<oldBDname>.sql.%Y%m%d.gz) | |
gunzip < `date +/var/sqlDump/<oldBDname>.sql.%Y%m%d.gz` | mysql -u <user_name> '-p<user_password>' <BDname> | |
CREATE USER <un> WITH PASSWORD '<up>'; | |
CREATE DATABASE sales ENCODING 'utf8' OWNER <un>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment