Created
March 9, 2012 06:33
-
-
Save masasdani/2005349 to your computer and use it in GitHub Desktop.
mysql backup and reset
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
#mysql-backup | |
mysqldump -h localhost –u root –p myrootpassword db_name > db_test.sql | |
#for multiple database | |
mysqldump -h localhost –u root –p myrootpassword db_name1 db_name2 > db_test.sql | |
#for all table | |
mysqldump -h localhost –u root –p myrootpassword -all-databases > db_test.sql | |
#for specifiec table | |
mysqldump --user root --password=myrootpassword db_test customers \ > db_test_customers.sql | |
#restoring | |
mysql --user root --password=myrootpassword new_db < db_test.sql | |
#reset password | |
sudo su | |
/etc/init.d/mysql stop | |
mysqld_safe --skip-grant-table --user=root | |
mysql -u root -p | |
UPDATE mysql.user set Password=PASSWORD('passwordbaru') WHERE user='root'; | |
flush privileges; | |
exit; | |
/etc/init.d/mysql restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment