Skip to content

MySQL Backup and Restore

So my next task was to move a forum from the old server to the new one. Download phpBB from and copy the expanded tar-ball to the web folder, then follow the standard installation instructions (which involve setting permissions appropriately for security and editing config.php). That part is easy enough.

Creating a backup from MySQL is also easy:

mysqldump -u user -p phpbb > phpbb.backup.sql

The -p flag prompts for the database password. Then use scp to move the backup file to the new server, and run

mysql -u user phpbb < phpbb.backup.sql

There's a catch. How to tell what the MySQL user is on a new installation. MySQL comes with 2 x 2 users - 'root' and '' (empty name), on localhost and your server name (`hostname`). You can change a password like this:

mysqladmin -u root newpasswd

This, however, only sets the localhost password.

Next step: create the database to restore to:

mysql -u root -p
create database phpbb;

Then run the database restore command given above.

phpBB2 has a few more installation steps - run the update script (in the install subdirectory, which one depends on what version you are upgrading from), delete the contrib and install subfolders, and check the settings in the Admin panel (link is /phpBB2/admin/).

You may also want to copy over any avatars in /phpBB2/images/avatars/ to the new site.

Post a Comment

Your email is never published nor shared. Required fields are marked *