Uh-oh! Unable to import site (database problem)

What issue or error are you experiencing?

Can not import database in Local copy of the Wordpress site.


What steps can be taken to replicate the issue?

This is a fresh Local install (.deb on linux ubuntu 23.04), connected to my employers WP development wp-engine site, downloaded it and everything seems to run fine except the database import. I have multiple lightning-services processes running, amongst which is a mysql process that listens on localhost:10004.

# netstat -ltnp | grep mysq
tcp        0      0 127.0.0.1:10004         0.0.0.0:*               LISTEN      549679/mysqld       
tcp6       0      0 ::1:10004               :::*                    LISTEN      549679/mysqld

But the import says it can’t connect as root@localhost using the default password:
image
This is the exact error in the Local logs:

10/10/2023, 1:56:48 PM [warn] [main] ImporterWPE: Unable to import site. -- {"stack":"Error: Command failed: %%userDataPath%%/lightning-services/mysql-8.0.16+6/bin/linux/bin/mysql --default-character-set=utf8 -A --skip-column-names -e SELECT @@SQL_MODE;\nERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)\n\n    at ChildProcess.exithandler (node:child_process:430:12)\n    at ChildProcess.emit (node:events:513:28)\n    at maybeClose (node:internal/child_process:1091:16)\n    at Socket.<anonymous> (node:internal/child_process:449:11)\n    at Socket.emit (node:events:513:28)\n    at Pipe.<anonymous> (node:net:322:12)"}

Connecting to the socket works like a charm? So why can’t Local connect and import the database?

# /home/martin/.config/Local/lightning-services/mysql-8.0.16+6/bin/linux/bin/mysql --default-character-set=utf8 -A --skip-column-names -e "SELECT @@SQL_MODE;" -S /home/martin/.config/Local/run/k19pNJY-s/mysql/mysqld.sock
+-----------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+-----------------------------------------------------------------------------------------------------------------------+

System Details

  • Local Version: 8.0.0-20231009.2
  • Operating System (OS) and OS version: Ubuntu 23.04

Hi @mrvanes

Are you able to manually import it using these steps?

I would, if I knew where it stored and kept autoload.sql?

10/10/2023, 5:29:39 PM [info] [main] WPEPullService: Downloaded autoload.sql from devinacadem. File size of 11360178 bytes

Are you able to download a backup of your WPE site? That will give you a zip file including the Database. You could also use a free plugin like WP Migrate Lite to grab a site backup as well.

I can access the admin pages of the site, but “export” would result in a .wxr (xml base) file, it says? 'm not sure whether I can install plugins though?

On your WP Engine dashboard you would be creating and downloading a backup of the hosted site with the instructions on the link above, not trying to export from within the WordPress dashboard.

Yes, managed to do that now.
I have the DB backup, but I assume I need to load it into a database called ‘local’? This doesn’t exist (probably due to the failure) so should I create an empty DB local?

Hi @mrvanes

It shouldn’t matter too much but you could use a command like wp db reset --yes before importing the new DB just to make sure it’s a clean install. After that you could jump to the last few steps here.

There is no command ‘wp’ and Open site shell doesn’t work (for me, I’m on KDE. Maybe you hard-coded the required shell application?)

I can load the DB into the Local server, I just need to know the required name?

Sorry looking back I see that you mentioned the database doesn’t exist at all or failed?

I assume I need to load it into a database called ‘local’? This doesn’t exist (probably due to the failure) so should I create an empty DB local?

What might be easier is just spinning up a new, blank site in Local which is what I was inferring when I mentioned the steps to manually import a site. That way you’ll spin up a base install and then manually replace its files and DB with your WP-Content and SQL database.

There is no command ‘wp’ and Open site shell doesn’t work (for me, I’m on KDE. Maybe you hard-coded the required shell application?)

When you click on Open Site Shell what happens? Do you get an error or does it just not open at all?

If you go to Preferences>Advanced>Appearance & Behavior you can see what your default Terminal application is set to.

Ok, this is embarassing. I redid the whole pull, and this time everything seems ok, even the database pull and restore (btw Open Site shell still doesn’t work, nothing happens when I click the option and I can’t find any reference to terminal in preferences).

Thank you very much for your timely responses and patient support!
Let’s see now whether I can tame this beast from here :wink:

1 Like

Glad to hear you made some progress @mrvanes! Happy Developing :green_heart:

And now all my problems are solved. Please keep track of this somewhere in your knowledge base (I mentioned KDE/Plasma!) and please consider using the platform indepent /usr/bin/x-terminal-emulator

https://neilpie.co.uk/2023/06/16/local-wp-open-site-shell-not-working-on-kde-plasma/

1 Like

Thank you for sharing that so other users will be able to search for and find here now. I’ll check with the Dev team on this as well.

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