How do I import a large MySQL Database?

QUESTIONS CENTRECategory: apacheHow do I import a large MySQL Database?
ZENHOST Support Staff asked 6 years ago

You should be able to use an Online Manager (like PHPmyAdmin ) to import databases that are less than 55 MB in size without issue.

But if you can’t overwrite the php.ini settings, and there is a file upload size limitation by your host, there is a better way to bypass this problem, the only thing you need is SSH access and of course

the database host (usualy localhost), the database username, the database password and a path where you have uploaded your .sql file.

First you need to upload your file on the server via ftp. You need to remember where you have uploaded the file (path) so you can later

add it to the command.

So you need to be able to execute this command via SSH.

Replace the DB_HOST with your host (normally localhost), the DB_USER with the database username, the ‘DB_PASSWORD’ including the ‘ ‘ for example:  ‘1234’, the DB_NAME and then the exact full path of the file location, for example on linux is something like this: /home/username/public_html/file.sql

mysql -h DB_HOST -u DB_USER -p'DB_PASSWORD' DB_NAME < /path/to/file/db_import.sql

If all your data are completed correctly the process will be executed within minutes. This depends on horse server power (RAM/CPU)… and the size of the sql file.

You can then login back to your PHPmyAdmin area and you check that all of the database is loaded and was executed correctly.