process steps:
- export the database
- updated the static entries of the hostname in the database
- import the database
commands:
- mysqldump -u _USERNAME_ -p _DBNAME_ > _DBNAME_.sql
- cat _DBNAME_.sql | sed -e ‘s/_HOSTNAME_/_NEWHOSTNAME/g’ > _DBNAME_UPDATED.sql
- mysql -u _USERNAME_ -p _DBNAME_ < _DBNAME_UPDATED.sql
options & variables:
- _USERNAME_ = the the database user name
- -p = will prompt for the password
- _DBNAME_ = the name of the database
- _HOSTNAME_ = the hostname of the existing server
- _NEWHOSTNAME = the new hostname to use
- _DBNAME_UPDATED = the name of the new updated SQL file
Leave a Reply
Want to join the discussion?Feel free to contribute!