How to move database to localhost
Moving database to localhost is the process during which the database needs to be exported from the hosting server and imported in the local MySQL server. Also, since the database will be stored in the localhost, database configuration file needs to be edited in order to match local database details. This is only needed if the database details like database name, username and the password are different in the local MySQL server.
Lets start with exporting the database from the hosting server in which the database is stored. Login to MySQL by using phpMyAdmin which is compatible enough to manage database data and export/import it. Once logged in to phpMyAdmin, click on the database in the left side menu. It will expand all the tables created in that database. For instance, phpBB database tables should look as follows.
From here we have 2 options to export the database. One way is to select all tables by clicking on “Check All” at the bottom of the tables.
Then we can simply select “Export” option from “With selected:” list box. It will redirect to database export page. The same page can be reached quicker without selecting all tables. Locate “Export” tab from the top menu while all database tables are listed.
By clicking “Export” it will open new page with the same database export page. In addition, some advanced options available before exporting the database.
There are 2 methods for exporting the database: quick and custom. Quick method will display only the minimal options. In other words, it will allow to choose only exported database format. By default it’s set to “SQL”, but it’s possible to choose any other like CSV, PDF, XML, etc.
Custom method will expand the advanced options list that are basically required if there is a need to export database with specific options like compress it, add various statements, selecting only required tables, etc.
In this case, we will be focus only on quick method which provides database dump quickly. Simply click on “Go” button and the download window will appear.
It should provide database download in the format like “database_name.sql”. Once downloaded this file, we can start importing it in the local MySQL server. To do this, login to MySQL server either by using phpMyAdmin, SSH or any other possible way. We prefer to use phpMyAdmin due to it’s easy management.
Before importing the database, we will need to have new database and it’s username created. By using defined password for database username, we will be able to connect to MySQL over phpMyAdmin. There find newly created database and click it. Since it’s a new database it won’t have any tables inside. To fill it with our database tables, go to “Import” where it’s possible to upload downloaded .sql file.
Click “Choose File” and select downloaded .sql file to import it. As it’s explained, file may be compressed or uncompressed and it’s maximum size can be 10MB. However, sometimes it might happen that database file might be larger than 10MB. In such case, it might be needed to set higher values for file upload limits. Once the database will be imported, we should see basically the same tables as it was in remote server.
That’s it. Database has been imported successfully and can be used with phpBB forum hosted in the local web server. In the case it’s showing warning about the problem with connecting to database, we should make sure database name, username and password matches database settings defined in the file “config.php” located in phpBB root directory.