Importing a database using phpMyAdmin in cPanel is a straightforward process that allows you to restore or migrate databases.
Follow the steps below:
Step 1: Log in to cPanel
- Open your browser and navigate to your cPanel login page (e.g.,
https://yourdomain.com:2083
). - Enter your username and password, then click Log in.
Step 2: Access phpMyAdmin
- Scroll to the Databases section in the cPanel dashboard.
- Click on phpMyAdmin.
Step 3: Select the Database
- In the phpMyAdmin interface, locate the left-hand sidebar that lists all the databases.
- Click on the name of the database where you want to import the data.
- If the database does not exist, create it first via MySQL Databases in cPanel.
Step 4: Open the Import Tab
- With the database selected, click the Import tab at the top of the phpMyAdmin interface.
Step 5: Upload the Database File
- In the File to Import section, click Choose File.
- Select the database file from your local computer.
- The file should typically be in
.sql
format. If it is compressed (e.g.,.zip
or.gz
), phpMyAdmin can handle the decompression.
- The file should typically be in
- Optional: Adjust import settings, such as the character set (default is usually utf8) or compatibility options, if required.
Step 6: Start the Import
- Scroll to the bottom of the page and click Go.
- phpMyAdmin will begin importing the database.
- The time required depends on the size of the database.
Step 7: Verify the Import
- After the import completes, you’ll see a success message if it was successful.
- Navigate to the Structure tab to verify that the tables and data have been imported correctly.
Tips for Importing Databases
- Database Size Limit: Some hosting providers impose upload limits for phpMyAdmin. If your database is too large, consider using SSH or contacting your hosting provider for assistance.
- Error Handling: If you encounter errors (e.g.,
max_execution_time
ormax_file_size
), ask your hosting provider to increase the limits or split the SQL file into smaller chunks. - Backup Existing Database: Before importing, create a backup of the current database to avoid accidental data loss.
By following these steps, you can easily import a database via phpMyAdmin in cPanel and ensure your website or application has the necessary data to function correctly.