Skip to content Skip to sidebar Skip to footer

How to Upload Mysql Database to to Cpanel

In that location are multiple ways by which you can import the contents of a MySQL database. This article will embrace two methods washed straight within the tools on our servers.

  • How to Import Databases via phpMyAdmin⤵
  • How to Import Databases via Control Line (SSH)⤵

This commodity also discusses mutual issues, recommended solutions, and some unremarkably asked questions.

  • Common Issues⤵
  • Frequently Asked Questions⤵

Note: The cPanel has imposed an upload size limit of 50MB for databases. You may encounter a timeout prompt when importing more than 50MB. If you experience this fourth dimension out, please contact usa via phone or Alive Chat to help you lot.


How to Import Databases via phpMyAdmin

This video will visually walk you through importing a database using phpMyAdmin from cPanel.


To import databases via phpMyAdmin:

  1. Log in to the cPanel.
  2. Locate the Databases section, then click thephpMyAdmin icon.

    cPanel's phpMyAdmin

  3. If the database does not exist, please create a database first, a user, and requite the user full privileges via the MySQL® Databases. Note the username and password.

    You may desire to refer to this article for instructions: How To Create or Delete a MySQL Database or User.

  4. Within the phpMyAdmin, select the new database name from the left-hand menu.
    phpMyAdmin - Select Database
  5. Click the Import tab in the chief area of phpMyAdmin.

    cPanel - phpMyadmin's Import Tab

  6. Browse for the .sql file on your computer using the Choose File button.
  7. Once the .sql file was attached, scroll downwardly and click on theBecome button.
  8. A confirmation prompt volition appear, notifying you nearly the successful import.

How to Import Databases via Control Line (SSH)

Advanced users may wish to use SSH to access and make changes to their accounts, offer a more robust set of options with fewer limitations. These instructions will crave a basic familiarity with SSH. If you are interested in learning to utilize SSH, please bank check the commodity below.

  • How Do I Become and Use SSH Access?

To import your database later on you lot have logged in to your account with SSH:

Note: Your database file must be in .sql format. It cannot exist compressed in a .zip or .tar.gz.

  1. Upload your database to your domicile directory (This may be done via cPanel File Manager, an FTP customer, or SSH).
  2. If the database does not be, please create a database, a user, and give the user full privileges to the database. Note the username and password.
  3. Log in to your server via SSH.
  4. Use the ls -l command to verify that the file is in your electric current directory.
  5. If the file is not present, upload/move the file to the right directory or navigate to the directory where the file is located.
  6. Enter the post-obit control, replacing 'user_name,' 'database_name, and 'file.sql' with the correct values for your database and file:

    mysql -p -u user_name database_name < file.sql

  7. Y'all volition be prompted for your database user password, and then your database will exist imported.

Notes:

  • HostGator recommends using the database user with the database user's password.
  • Make sure your database name and username has your HostGator cPanel username prefix (e.m. 'cPanelUsername_databasename'; 'cPanelUsername_databaseUsername').

Common Issues

Your import file is too large!

The phpMyAdmin upload limit on HostGator shared, and reseller hosting packages is 50MB. This is also the default on VPS and Dedicated servers.

Users on a VPS or Dedicated server may increase this value by increasing the cPanel PHP max upload size and the cPanel PHP max Post size from WHM nether Tweak Settings.

To import a file larger than 50MB, upload the file to your server and contact us via phone or Live Chat with the name of the file and the name of the database to import it to.


Script Timeout Passed

This error is received when the database takes too long for phpMyAdmin to import, causing the phpMyAdmin import process to be terminated.

If y'all experience this timeout, please upload the database backup file to your HostGator account and contact u.s.a. via phone or Live Chat with the details. Our administrators will perform the import for y'all.

For security reasons, it's best to upload your database to the /home/USERNAME department of your account. (Replace USERNAME with your cPanel username.)


#1044 - Access denied for user 'username1'@'localhost' to database 'user2_wrdp9'        

The problem hither is your import file contains an SQL query that attempts to create a database for the wrong username. Notice the user2 in 'user2_wrdp9' does non match the username1 in 'username1'@'localhost'. Someone must edit the import file and change the old user2 to your new username1. (If you do not experience comfortable editing your import file, we will be glad to help you exercise that.) Here is an example of what information technology looks like (notice three places where the username is outdated):

□□--□-- Database: `user2_wrdp9`□--□CREATE DATABASE `user2_wrdp9` DEFAULT Grapheme Set latin1 COLLATE latin1_swedish_ci;□USE `user2_wrdp9`;□□--


#1044 - Access denied for user 'username1'@'localhost' to database 'wrdp9'        

Aforementioned as the previous event, the right username is missing. On a shared server, your database names must ever expect like something_something.


#1049 - Unknown database 'username1_wrdp9'

The problem is your import file does non have a query to create the database before importing the

information. Go to cPanel > MySQL Databases and create a database with that name (in my instance, "wrdp9"). Then re-attempt your import.


#1007 - Can't create database 'username1_wrdp9'; database exists        

The trouble here is that your import file contains an SQL query that attempts to create an existing database. If the database is empty, go to cPanel > MySQL Databases and remove that empty database; then re-attempt your import. If the database is non empty, someone must edit the import file and remove the CREATE DATABASE query. (If you practice not feel comfortable editing your import file, we volition be glad to assistance yous do that.) Here is an example of what it looks like:

□CREATE DATABASE `username1_wrdp9` DEFAULT Grapheme Fix latin1 COLLATE latin1_swedish_ci;


#1064 - You lot take an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to utilize almost...

The file does not contain backup data for a database, or the file has been inverse or corrupted.


ERROR 1044 (42000): Access denied for user 'username1'@'localhost' to database 'username1_wrdp9'

If you get this mistake, you lot do not have privileges on user_* to use Create. HostGator needs to correct this issue for you.

Notwithstanding, if you need to import now, and tin can't look, here is a workaround.

The trouble here is your import file contains at least one SQL query that attempts to create a database, and you do not have the privilege to do and then. Someone must edit the import file and remove the CREATE DATABASE query. (If y'all do non feel comfortable editing your import file, we volition exist glad to help y'all practise that.)

Here is an case of what it looks like:

□CREATE DATABASE `username1_wrdp9` DEFAULT Grapheme SET latin1 COLLATE latin1_swedish_ci;

Later removing this code, you must get to cPanel and click the MySQL Databases icon. Here you must create your database with the name removed from the import file (in my example, "wrdp9"). Then you can Import the modified import file, and it will work.


How do you create a MySQL fill-in via your phpMyAdmin?

It is ever important to create a backup of your database to be restored in example of unforeseen events.

You can either do this through the fill-in characteristic of your cPanel or the export tab of phpMyAdmin.

Do you need to create a database before yous import another ane?

There needs to be an existing database and database user to attach the imported .sql file. One database is for ane .sql file.

If you accept multiple .sql files to be imported, yous volition need to create databases for each of them through your cPanel.

If you have no existing database, you volition need to create a new i via cPanel's MySQL Databases section.

How practise you add a MySQL database and database user to your business relationship?

Please refer to the commodity, How to Create or Delete a MySQL Database or User, for creating a database and database user.

Do you have to remove the old database first before you import the fill-in database file, or is that done automatically?

If you lot wish to employ a different .sql file or import your fill-in file for your existing database, you start need to Drib all the database tables. Not dropping all tables will retain the tables that practice not exist in the new .sql file and overwrite the existing ones. All the same, you tin can still retain some tables in that database if you wish. The tables in your new .sql file will overwrite the tables with the same table name existing in the database.

  • How To Drop Tables From a Database in phpMyAdmin

whiteantionce.blogspot.com

Source: https://www.hostgator.com/help/article/how-to-import-your-mysql-database

Post a Comment for "How to Upload Mysql Database to to Cpanel"