Just Host Web Hosting Help
MySQL Database Import via Command Line
Summary
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.
Note: SSH access is required for this process. Click Here for information about getting SSH access
Using 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.
- If the database does not exist please create one with an user. Note the username and password.
- Log into the server through SSH
- Navigate to the directory where your .sql file is.
- Type this this command:
mysql -p -u username database_name < file.sqlNote: Just Host recomends using the database user with the database users password not the cPanel main user and password. The -p will cause mysql to prompt for your account's password. Do not put passwords in command line in plain text, but let the system prompt for a password. This is for your own security.
Make sure your database name has your Just Host username prefix with the _ (underscore) after it and the database name.Knowledgebase Article
186,517 views
bookmark
share
Share or save this via:
tags: command database import line mysql phpmyadmin ssh
(updated 397 days ago)
Recommended Help Content
How to import and export a MySQL Database from the command line. (updated 266 days ago)
How do I import a backup of my database (.sql file) using phpMyAdmin? (updated 215 days ago)
I need to Export or Import a MySQL database (updated 1396 days ago)
Related Help Content
A repository of information on how you can manage your database by using the phpMyAdmin interface. (updated 216 days ago)
How to Restore your MySQL Database? (updated 404 days ago)
Users having problems connecting to mysql database using SSH and/or putty/other client. (updated 1111 days ago)
A guide to duplicating a MySQL database using phpMyAdmin (updated 216 days ago)
A tutorial on how to perminately delete columns from your mySQL database using phpMyAdmin (updated 215 days ago)
Guidance on adding tables to your mySQL database in phpMyAdmin (updated 216 days ago)
Step by step directions on how you can search your database using phpMyAdmin (updated 216 days ago)
How to repair and optimize your database using phpMyAdmin: (updated 408 days ago)
E-mail
Twitter
Google Bookmarks
Facebook
MySpace
Digg
Reddit
Delicious
LinkedIn
StumbleUpon