Error importing a new database

Q: Date/Time this occurred (Provide your time zone also)
A: 15:00 UK

Q: DevKinsta Version
A: 2.11.0.7044

Q: OS Version
A: MacOS Monterey 12.6.6

Q: Docker Desktop Version
A: 4.20

Q: Were any error codes or messages observed? If so, what were they?
A: Browser error:

Hmmm… can’t reach this page

It looks like the webpage at http://127.0.0.1:15200/?server=devkinsta_db&username=root&db=examplesite&import=%examplesite-migrate-20231129130605.sql.gz' might be having issues or it may have moved permanently to a new web address.

Q: Detailed Description of the Problem
A: I have “examplesite” site running that want to update. I go to the live site and export the database, then open MyKinsta’s Database Manager and try to upload. It takes me straight to an error page with the message above.

I tried to delete the site and create a new one in MyKinsta, all fine, but the same import error when I try to import the database. Have tried in multiple browsers.

Hi @designlobby,
If the import fails on a live site in MyKinsta, I would recommend reaching out to our support via chat as they will be able to try to replicate the error on their side and help you finding the culprit.

Regards,
Alessandro

Hi @Alessandro,
The issue is only with uploading a database in DevKinsta via Database Manager, not live. Apologies for the confusion!

Regards,
Gareth

Hi Gareth :wave:

Thank you for your confirmation/clarification.
I’ve just tried the same on my Linux (Ubuntu) laptop - since I don’t have Mac here :slight_smile: and I could import the .sql.gz file that I exported from my Live site (from MyKinsta) to my local computer using the Adminer tool (Database manager) just fine.

After I exported my database from my Live Site (using PHPMyAdmin tool) into .sql file (and I compressed it to .gz file), I then launched the Database manager from DevKinsta and then I dropped all tables I had in my existing database as shown below (No tables):

Then, I chose the database file (.sql.gz) on my local computer and uploaded it:

After I clicked the “Execute” button, it showed the imported tables/data as follow:

So far I couldn’t replicate that error message that you got on your browser when importing the .sql.gz file using Database manager (Adminer tool) :thinking:

I also noticed from the error message you provided, the link mentioned:
%examplesite-migrate-20231129130605.sql.gz'

I’m not sure why it has % in front of it ?
Could you please check your .sql.gz file in question and perhaps try to rename it with different name - and make sure there’s no “space” in front of it , and try to import that .sql.gz file again using the Adminer Database manager?

If it’s still not working properly on your browser, you might want to try to import your database using WP CLI instead, with the following steps:

  1. Move or copy that .sql.gz file in question to your ~/DevKinsta/public/examplesite sub-folder and extract/de-compress it to .sql file within that sub-folder.

  2. Open Terminal program , and run this command:
    docker exec -u www-data -it devkinsta_fpm bash

  3. In that devkinsta_fpm docker/container, type the following to go to your examplesite sub-folder:
    cd /www/kinsta/public/examplesite/

  4. Then inside that /www/kinsta/public/examplesite/ sub-folder, be sure to check if the .sql database file is there ( you can check with something like: ls -la yourdatabasefile.sql )

  5. After that, you can try to perform this WP CLI to import that .sql file to your existing database:
    wp db import yourdatabasefile.sql
    If all is well, you should see: Success: Imported from 'yourdatabasefile.sql'.

In case, it returns an error that such table(s) already exist(s), you may want to first make a backup of your existing local DB with WP CLI: wp db export (and it will create a new .sql file in your /www/kinsta/public/examplesite/ subfolder).
After that you can empty that existing local DB with this WP CLI: wp db reset (and answer with y ). Once it’s reset, you can then try to import the previous DB file with the same WP CLI above: wp db import yourdatabasefile.sql

When you’ve done with the DB import, you can type: exit to quit from that devkinsta_fpm docker/container, and you may then remove/delete that .sql file(s) in question.

Note:
Since you’re importing the .sql that you exported/dumped from your Live Site, the URLs in your local database may still be referencing to your live site’s domain URL, and if that so then you will need to perform Search and Replace too via WP CLI (to replace the live site’s domain URL with your .local domain URL).

Hope that helps!

Best regards,
Agus

Hi @Agus

Thank you for your detailed post and the steps you took.

After a few different attempts at getting this working I eventually tried to upload an unzipped .sql file via DevKinsta database manager and it worked! Maybe there was an error in the .sql.gz version?

FYI I received an error in Terminal when trying to import via WP CLI which says I am running PHP 7.4 (short version of the error msg):

PHP 12. trigger_error($message = 'Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0". You are running 7.4.33.', $error_type = 256) /www/kinsta/public/examplesite/site/vendor/composer/platform_check.php:24

The site in DevKinsta is set to run PHP8.0 and my Mac is also.

designlobby@Designs-iMac ~ % php -v
PHP 8.0.22 (cli) (built: Aug  4 2022 02:52:21) ( NTS )

So I’m unsure why I received a PHP version error using WP CLI?

Re your other questions, the .sql.gz file had no spaces, it was exported via WP DB Migrate plugin, and the URLs were updated as part of that process. I’m not sure why the % appeared in the error page url.

Anyway, I’m happy, the db upload worked without the gzip (fortunately the db is quite small). Thank you again for your help pointing me in the right direction. I will let you know if I continue to have any issues.

Many thanks,
Gareth

Hey Gareth :wave:,

Glad you were able to import the database!
Regarding the PHP version mismatch, by default WPCLI uses a different PHP version. When needed, that can usually be changed by editing the .bash_profile file. You can check the PHP version currently in use by WPCLI by running the following command:

wp cli info

Regards,
Alessandro

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.