Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > General Support > Topic : Importing Large Databases via Command Line / Terminal



Threaded Mode | Print  

 Importing Large Databases via Command Line / Terminal, AMPPS Import Database in Terminal (3 Replies, Read 9969 times)
foxyhare
Group: Member
Post Group: Newbie
Posts: 10
Status:
I've seen this asked a lot and so I'll give a little help:

Scenario: You have a database file that's too large for import. What do you do?

Solution: Use your Terminal to import the database, within a few following steps:

1. Open your AMPPS install and START / load your environment.

2. In the AMPPS Control Center window, click the MySQL tab (on the lefthand side).

3. In this new window, click the Configuration item / link.

4. This will open your default editor, you'll want to modify the following:

max_allowed_packet

For most standard uses you should need anymore than 1000M here.

There are two areas for this to be changed, so do a search all and edit.

5. Save your changes and be sure to restart both Apache and MySQL.

6. Open your Terminal.

7. Easiest to move the database file to your desktop for path convenience.

8. If you've not already, create the database or install being replaced.

So for example, if installing WordPress, create your Installation via Softaculous.

Remember the name of the database when creating it, you'll need it shortly.

9. In your Terminal, use the following command line:

/Applications/AMPPS/mysql/bin/mysql -u root -p DATABASE_NAME < /Users/USERNAME/Desktop/DATABASE_FILE_NAME.sql

The CAPITAL names will require being replaced with your own specific uses:

DATABASE_NAME: This is the name of the database your wanting to import to.
USERNAME: This is the name of your device/computer user currently being used.
DATABASE_FILE_NAME: This is the SQL file name that you moved to your desktop.

*Important: If you did not move the database .sql file to your desktop, then you'll want to change the path the reflect it's location. So for example, if you left it in your "downloads" folder you'd want the path to reflect that folder name.

On running the command, it will prompt you for a password. This is the password of your root user in MySQL. So if this is a default installation of AMPPS with no customization, chances are you're using the default password and that is "mysql".

10. Once done, you can check the database to see if the import was successful.

If done correctly, there should be no issues.

You may want to go in and edit the URL paths in the database tables, especially if using WordPress, you'll want to edit the wp_options table to reflect the new localhost URL that you're using.

Hope it helps!
IP: --   

Importing Large Databases via Command Line / Terminal
foxyhare
Group: Member
Post Group: Newbie
Posts: 10
Status:
Was going to edit this but cannot see to find the option.

It should be in "most standard uses you shouldn't need anymore than 1000MB's" and that should be more than suffice.
IP: --   

Importing Large Databases via Command Line / Terminal
jumla40_guy
Group: Member
Post Group: Newbie
Posts: 7
Status:
This is the method using Adminer and NOT phpmyadmin that I employ.

1. Stop APACHE server
2. In the AMPPS -> Control Panel -> PHP x.x -> Configuration -> I reset these values to:
      post_max_size = 32M
      upload_max_filesize = 38M
    and SAVE
3. Restart APACHE server
4. In Adminer I select IMPORT and import the "localhost.sql.gz" file of all my Databases

After a few minutes I'm done.

Note: when creating your all Databases file do NOT import "information_schema, mysql, performance_schema" tables
IP: --   

Importing Large Databases via Command Line / Terminal
jumla40_guy
Group: Member
Post Group: Newbie
Posts: 7
Status:
If your DB is still too large then you can upload the DB directly from the server.
Rename and then copy your DB file to:

..\Ampps\www\adminer\adminer.sql.gz

Board Image
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is April 25, 2024, 10:20 pm.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.023