Skip to content

Instantly share code, notes, and snippets.

@maronl
Last active March 1, 2016 09:15
Show Gist options
  • Save maronl/55ea308073371dfba3e6 to your computer and use it in GitHub Desktop.
Save maronl/55ea308073371dfba3e6 to your computer and use it in GitHub Desktop.
create mysql database for testing
create DATABASE DB_XXXXXXX CHARACTER SET = utf8;
create user 'USER_XXX'@'localhost' identified by 'PWD_XXX';
grant all on DB_XXXXXXX.* to 'USER_XXX'@'localhost';
mysqldump -u root -p --single-transaction dbname | gzip > filename.sql.gz
grant all on dbname.* to 'username'@'%' identified by 'xxxxxx' with grant option;
UPDATE `mysql`.`proc` p SET definer = 'root@%’ WHERE definer=’xxxxxx@%’ AND db='dbname';
mysqldump --host=hostname --port=3306 -u root -p --single-transaction db_name | gzip > dump_name.sql.gz
#connect hostname and port
mysql --host=hostname --port=3306 -u root -p
#import mysqldump
gzip -dc < dump_name.sql.gz | mysql -u root -p db_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment