Search the Site:

How to Import a MySQL Database

I wish to import a MySQL database. How can I do it?

Thanks!

Instructions to import a MySQL database using SSH

Instructions to import a MySQL database using SSH

  1. Log into your Web space using an FTP/ SFTP client. You will need to know your username and password.
  2. Find your existing .SQL database and upload it to your Web space using your FTP/ SFTP client. Make sure you remember the path to where you upload this file.
  3. You may also use SCP client instead of an FTP/ SFTP client to upload the file, if your web host supports it.
  4. Log into your Web space using a SSH client you are comfortable using. You will need the username and password assigned to you by your Web-hosting provider.
  5. Your web hosting provider might give you access via Telnet instead of SSH. That should be fine as well. Login using a Telnet client in this scenario.
  6. Enter the following into the command line, using your own database name, file name, username and password instead of the words in capitals.

    mysql -uUSERNAME –pPASSWORD DATABASENAME < /PATH/TO/DATABASEBACKUPFILE.sql

    For example, if my username was "nibbleguru", my password "example", my database name "testdb" and the absolute path to my file "/home/nibbleguru/my_db_backup.sql", I would type:

    mysql –unibbleguru –pexample testdb < /home/nibbleguru/my_db_backup.sql

Instructions to import a MySQL database using phpMyAdmin

Instructions to import a MySQL database using phpMyAdmin

  1. Most good web hosting providers provide access to a program called phpMyAdmin, which lets you manage your MySQL database.
    Log onto the phpMyAdmin page from your Web space. You will need the username and password assigned to you by your Web-hosting provider.
  2. Select the database you wish to import the old data into from the drop-down Database Selection box on the left of the page.
  3. Click the SQL tab toward the top of the page that opens.
  4. Click the Browse button located toward the bottom of the page.
  5. Find the .SQL file where it is saved on your hard drive, select it and click "Open".
  6. Click the Go button. The data in your SQL file has now been imported into your database.

If your hosting provider doesn't provide you with access to phpMyAdmin then you can also install one of your own.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <i> <object> <param> <embed> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

2 Steps to Post a New Problem

2 Steps to Post a New Problem

Register
Login
Post New Problem

DISCLAIMER: The content on the site has been submitted by the users. NibbleGuru.com has no responsibility other than in removing material from the website when we have been notified of a copyright violation. Notify here.