process steps:

  1. export the database
  2. updated the static entries of the hostname in the database
  3. import the database

commands:

  1. mysqldump -u _USERNAME_ -p _DBNAME_ > _DBNAME_.sql
  2. cat _DBNAME_.sql | sed -e ‘s/_HOSTNAME_/_NEWHOSTNAME/g’ > _DBNAME_UPDATED.sql
  3. 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

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.