MilesWeb
MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length

 

News:

SMF - Just Installed!


Author Topic: How to import MySQL database  (Read 3184 times)

0 Members and 1 Guest are viewing this topic.

Offline kunal.m

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
How to import MySQL database
« on: June 13, 2016, 03:43:39 PM »
Hi All,

There are multiple ways by which you can import the contents of a MySQL database. Below are the two method you can import MYSQL database.
  • Importing Databases via phpMyAdmin
  • Importing Databases via Command Line (SSH)
1. Importing Databases via phpMyAdmin

Quote
    Go to phpMyAdmin
    Click the new database name in the top left (optional)
    Click Import in the main area of phpMyAdmin
    Browse for the .sql file on your computer and click Go

1. Importing Databases via Command Line (SSH)

If you are not aware how to connect ssh. Please check the below for information on how to get connect ssh:

How To Connect Server Via SSH

To import your database after you have logged in to your account with SSH

1. Upload your database to your home directory.
2. 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 not aware how to create database. Please check the below for information on how to create database:

How to create a database form cPanel.

3. Log into your server via SSH.
4. Use the ls -l command to verify that the file is in your current directory.
5. If the file is not present, upload/move the file to the correct directory, or navigate to the directory where the file is located.
6. Enter the following command, replacing 'user_name', 'database_name, and 'file.sql' with the correct values for your database and file:
Quote
mysql -p -u user_name database_name < file.sql

7. You will be prompted for your database user password, and then your database will be imported.

That's All....!!! :)
« Last Edit: June 13, 2016, 03:59:26 PM by kunal.m »

MilesWeb Hosting Forum

How to import MySQL database
« on: June 13, 2016, 03:43:39 PM »