Title: Importing database to localhost
Last modified: August 30, 2016

---

# Importing database to localhost

 *  [gladavisj](https://wordpress.org/support/users/gladavisj/)
 * (@gladavisj)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/importing-database-to-localhost/)
 * I’m setting up my localhost as a testbed for a client’s live site. This is so
   I can test caching and CDN because the site is getting big and slow and unwieldy.
   
   Database is created and copy of wp folder in the correct location. No I want 
   to import the database copy (xxxx.zip) into mamp using phpmyadmin. Unfortunately
   it keeps timing out, presumably because the database has just got too big. (phpmyadmin
   says its size limit is 32mb… my zip file is 9mb but unzipped it is 64mb) So have
   I painted myself into a corner? Does Mamp Pro allow for bigger files? Do any 
   of the phpmyadmin import parameters actually work? (the tickbox to allow interruptions
   in case of large files appears to have no effect). Any clues would be welcome.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/importing-database-to-localhost/#post-6690789)
 * MAMP Pro will be of no help. The problem is that phpMyAdmin is extremely limited
   when it comes to importing databases. There is a solution, however, but it will
   require some effort on your part.
 * The MySQL server has a command-line interface that can be used to import databases,
   and it has none of the limitations of phpMyAdmin. First, un-ZIP the file to obain
   the original .sql file. Let’s call it **testdb.sql**. Next, you will need to 
   go to your system command line, and in Windows, go to the directory where the
   mysql.exe file is located. Then type the following to test whether you are in
   the correct location:
 *     ```
       mysql -uroot -p
       ```
   
 * MySQL will ask for a password. Type in the password for the root database user(
   you set it when you installed MAMP); nothing will be echoed. After pressing Enter,
   you should see a short message from MySQL and the prompt will change to **mysql
   >**. If you see this, you’re in the right place! Type **quit** to exit MySQL.
 * I will now assume you have created the database to use for the import; let’s 
   call it **testdb**. Now enter the following command:
 *     ```
       mysql -uroot -p --default-character-set=utf8 testdb < /path/to/sql/file/testdb.sql
       ```
   
 * and press Enter. You will again be asked for the root DB password. MySQl will
   then start importing the database. Please note that this could take anywhere 
   from a couple seconds to several minutes, depending on the size of the database.
   Once it completes, the command prompt will re-appear.
 * Now go to phpMyAdmin and check the testdb database.
 *  Thread Starter [gladavisj](https://wordpress.org/support/users/gladavisj/)
 * (@gladavisj)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/importing-database-to-localhost/#post-6690822)
 * Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Importing database to localhost’ is closed to new replies.

## Tags

 * [database import](https://wordpress.org/support/topic-tag/database-import/)
 * [Import](https://wordpress.org/support/topic-tag/import/)
 * [MAMP](https://wordpress.org/support/topic-tag/mamp/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 2 replies
 * 2 participants
 * Last reply from: [gladavisj](https://wordpress.org/support/users/gladavisj/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/importing-database-to-localhost/#post-6690822)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
