Bluehost Web Hosting Help
Importing Databases via Command Line (SSH)
Using SSH can be a superior way to manage the files and databases on your account. Using a simple command you can import a MySQL database into an existing database on your account. If are looking for instructions to export a database, please go to the Exporting Databases via Command Line (SSH) article. If you are looking for instructions for importing and exporting databases using phpMyAdmin, please go to the Export Databases with phpMyAdmin articles.
Using Command Line (SSH) to import your MySQL database
The file must be in .sql format. It can not be compressed in a .zip or .tar.gz file.
- Upload the SQL file to the server via the file manager or an FTP client.
- If the database does not exist, please create a database, a user, and give the user full privileges to the database. Note the username and password.
- If you are unsure how to make a database, please refer to the MySQL Database Creation article.
- Log into the server through SSH
- Navigate to the directory where your .sql file is.
- Type in this command:
mysql -p -u user_name database_name < file.sql (replace 'user_name', 'database_name', and 'file.sql' with the actual name.)
- You will be prompted for your database user password, and then your database will be imported.
Make sure your database name and username has your Bluehost username prefix (e.g. 'username_databasename'; 'username_databaseusername').
Recommended Help Content
Managing Databases via Command Line (SSH)
This article will instruct you how to export a database from the command line (SSH). (updated 699 days ago)
MySQL Import and Export
I need to Export or Import a MySQL database (updated 698 days ago)
How to import a MySQL Database using phpMyAdmin
How do I import a backup of my database (.sql file) using phpMyAdmin? (updated 96 days ago)
Related Help Content
How to Create and Delete MySQL Databases and Users
This article will explain MySQL database and user creation and deletion, and explain how to assign a user to a database. (updated 154 days ago)
Mysql connections with a dynamic (changing) IP Address using ssh/putty ect
Users having problems connecting to mysql database using SSH and/or putty/other client. (updated 1823 days ago)
Connecting Scripts to MySQL Databases
This article will explain how to connect your scripts to your MySQL databases. (updated 921 days ago)
How To Convert a MySQL Database to UTF-8
This article will explain how to convert a MySQL database to UTF-8. (updated 26 days ago)
MySQL Database Restore
How to Restore your MySQL Database? (updated 1117 days ago)
MySQL Database Compatibility
How do I make my MySQL database compatible with the version you provide? (updated 2125 days ago)
Resetting MySQL Database User and Password
This article will explain how to change the password for a database in the event that the original password is lost. (updated 921 days ago)
Is SSH/Shell access enabled by default? (updated 1285 days ago)