HOW DO I IMPORT A DATABASE (COMMAND LINE)?

**SSH access is needed for this process.

Also you will need the file in .sql format, meaning it can not be compressed in a .zip or .tar.gz file.

1) Once you have your sql file you will need to upload it to your server.

2) You will need to create the database if you have not done so already.

3) Once this database is created and your .sql file is on the server log into the server through SSH

4) Once in SSH navigate to the directory where your .sql file is.

5) Once there run this command:

# mysql -uusername -ppassword database_name < file.sql

Note:There is no space between '-u' and the username, or between '-p' and the password

username is the username of the user with rights to the database if you are unsure what the is you can use your username you used to sign into SSH.

Password also follows same guide lines.

Make sure your database name has your username prefix with the _ (underscore) after it and the database name.

This command with ONLY work if you are in the directory where the .sql file is.

6)  Execute this command and your database will import.

If you have any problems submit a help ticket.

Was this answer helpful?

 Print this Article

Also Read

Do you provide PostgresSQL for your accounts?

Yes. We do provide PostgresSQL interface for all cPanel users.

HOW DO I CREATE AN EMPTY MYSQL DATABASE?

1. First log in to your Cpanel 2. Click MySQL Databases 3. Create a...

HOW DO I GRANT PERMISSIONS TO CPANEL FOR MY MYSQL DATABASE ADMINISTRATOR WITHOUT GIVING THEM THE DOMAIN PASSWORD?

There is no way to grant them permission with cPanel. You can only create user/pass and...

Do you allow remote MySQL access in your servers?

Yes, to manage your databases remotely you will need to add an "access host" via the MySQL...

HOW DO I DUMP THE TABLE STRUCTURE FOR MY MYSQL DATABASE, BUT NONE OF THE DATA?

The command line option from SSH is: mysqldump -d -u -p database_name > file.sql Where...

Powered by WHMCompleteSolution