Creating, Importing, and Exporting MySQL Databases

Read the tutorial on how to create a database

Read the tutorial on how to export a database

In this article, we will learn how to import a database using phpMyAdmin.

You must have exported your database, and it is either a .sql, zip, or tar.gz file. You should have already created the new database that you’re importing into as well.

Steps on how to import your database

 

  • Log into cPanel
  • Open phpMyAdmin by clicking the phpMyAdmin icon
  • Select the database in the left menu that you will be working with
  • Click Import in the top menu
  • Under File to Import, click Browse and select the backup file you previously created (it will be either a .sql .zip or .tar.gz file).
  • Click Go at the bottom right
  • When the database has been imported successfully, you should see a message at the top of the page similar to: Import has been successfully finished, ## queries executed.

    Congratulations, you have just imported a database!

 

Troubleshooting

#1044 – Access denied

If you get the following error when importing a a database through PhpMyAdmin, you will need to edit the sql file you’re trying to import.

CREATE SCHEMA IF NOT EXISTS `DataBaseName` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

MySQL said: Documentation
#1044 - Access denied for user 'userna5'@'localhost' to database 'DatabaseName'

PhpMyAdmin does not allow you to CREATE databases due to security reasons. In order to get your SQL file to load you will need to remove the CREATE SCHEMA line at the beginning of your code

Share This Post With Friends

No Comments, Be The First!

Your email address will not be published.