Skip to content

Instantly share code, notes, and snippets.

@kolunar
Created April 24, 2017 22:52
Show Gist options
  • Save kolunar/53983ee3facb1ab1068171e87d9d8edb to your computer and use it in GitHub Desktop.
Save kolunar/53983ee3facb1ab1068171e87d9d8edb to your computer and use it in GitHub Desktop.
MySQL dump/create database and grant all privileges to specific user
mysqldump -uroot databasename > database.sql
mysql create database databasename DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
Option1
=======
$ mysqldump yourFirstDatabase -u user -ppassword > yourDatabase.sql
$ mysql yourSecondDatabase -u user -ppassword < yourDatabase.sql
Option2
=======
use databasename;
set autocommit = 0;
source database.sql;
commit;
mysql -uroot;
grant all on *.* to 'joomla_user'@'localhost';
flush privileges;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment