- Get db backup for www from daily backup server
- Copy the db to the nearest linux server (eg: 75)
- Bunzip the file:
#bunzip filename_xxx.bz2 - Use vi command to rename the db
#vi filename_xxx.sql - Esc > Shift + :
:%s/oldurl.my/newurl.org/g
** If the cursor already can move up and down then its done. - Esc > Shift + : > :wq > Enter
**Wait until the process finish - mkdir folder
- mv filename_xxx.sql folder/
- tar -cjf folder.tar.bz2 folder
- scp folder.tar.bz2 your@locationserver.my:
- Open related db server to restore the db.Copy the file from yourlocation server.
#scp your@locationserver.my:/home/you/ folder.tar.bz2 ./ - Untar the file first:
# tar -xjvf folder.tar.bz2 - Open folder and restore the db in server
# mysql -uroot -p --default-character-set=utf8 < filename_xxx.sql - Grant the privileges to the db
# GRANT ALL PRIVILEGES on db.* to 'username'@'applicationserverhost' IDENTIFIED BY 'password'
#FLUSH PRIVILEGES; - Check connection within the db and the application server.
#telnet applicationserverhost 3306; - From application server, test connection to db server
#mysql -uUSERNAME -p -h IP_databaseserver
eg: mysql -urepo_admin -p -h 172.XX.XXX.XX
** If error, connection refuse ask Network Admin to allow telnet both server in firewall setting. - Update the apps configuration file for the grant access. Check the application from browser.
- Done.
Tuesday, May 8, 2012
Mysql: My Own Notes( Backup & rename )
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment