Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Posts
    100

    How to import mysql dump file to database by SSH

    Hello,

    How to import mysql dump file to database by SSH?
    How to import mysql database host to other host database by SSH?

    Thanks.

  2. #2
    Join Date
    Apr 2009
    Location
    Guildford, Surrey, UK
    Posts
    12
    You should just be able to do:

    Code:
    mysql -u <username> -p<password> mysql_database < mysql_database_dump.sql
    to import the dump file back into MySQL. You'll need to ensure you've created the database and assigned the relevant users first, of course (otherwise use the root user and then deal with privileges later).

    Not entirely sure what you mean by the second question - are you wanting to allow other hosts to access the database already defined somewhere else?

    M.
    Systems Administrator
    Memset Dedicated Hosting
    PC Pro's Best Web Host four years running!
    http://www.memset.com

  3. #3
    Join Date
    Mar 2003
    Location
    /root
    Posts
    23,990
    Moved > Technical & Security Issues.

    Specially 4 U
    Reseller Hosting: Boost Your Websites | Fully Managed KVM VPS: 3.20 - 5.00 Ghz, Pure Dedicated Power
    JoneSolutions.Com is on the net 24/7 providing stable and reliable web hosting solutions, server management and services since 2001
    Debian|Ubuntu|cPanel|DirectAdmin|Enhance|Webuzo|Acronis|Estela|BitNinja|Nginx

  4. #4
    Join Date
    Mar 2009
    Posts
    75
    Hello,

    I have the answers for your two questions.

    How to import mysql dump file to database by SSH?

    You can use the below command from command prompt to access the database locally and to dump the dump file to the database.
    mysql -u <username> -p<password> mysql_database <
    mysql_database_dump.sql
    How to import mysql database host to other host database by SSH?

    For this to happen you have to enable the particular host in your server to allow the mysql connection.You can do it from the mysql configuration file /etc/my.cnf to make any particular host to access the databases or else you can grant privilege to that remote host user to access your database.

    The command you have to use is shown below:-
    mysql -h <server IP> -u <username> -p<password> mysql_database <
    mysql_database_dump.sql
    You can use your server hostname instead of your server IP address.

    Please try this and you will be successful.

  5. #5
    Join Date
    Jun 2008
    Posts
    100
    mbdrake, jai_hoo, net

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •