Local Community

SOMETIMES say "Error establishing a database connection"

I have been working with local very well many times but sometimes when I click the “admin” button, I can not enter to the WordPress dashboard. because show in the screen the message
“Error establishing a database connection”.
I have to go the “visit my site” button and because I do not log out the wp session, I can restart to work.
How can I do to enter using the “admin” button?

Hey @hrr, Welcome to the Local Community Forums!

That’s definitely odd. Do you notice if this happens right after the site has been started?

I wonder if the database software hasn’t had a chance to fully “turn on” before trying to access the site. You might try waiting a few seconds (I don’t think any longer than about 20 seconds) and then try clicking the “Admin” again.

A couple of follow up questions:

  • What operating system is installed, and what version is it using?
  • Can you please provide your Local Log? See this Community Forum post for instructions on how to do so:

Thanks for your answer:
I have two more questions that I have not receive an answer. Can you help wit it?

  1. I create the live link and send it by email the link. The client said that he can not see the pictures in webpage?
    What can I do?
    2: My actual domain is localhost:1004. Can I change the domain?

Hey @hrr – glad to help!

That’s definitely odd! To troubleshoot, are you able to view the site over a live link on a different computer? From there, you should be able to view the browser console to see what errors are showing.

For the site that you are creating, are you using a Page Builder? I’ve seen some instances where the way that the page-builder saves the URL makes it so Local can’t update the Local site’s URL to the live link URL.

That means that Local is using the localhost Router Mode and is often due to some other application listening on the default HTTP port 80. This can be lots of things from other offline development tools like Mamp or any other tool that makes it so Local can’t use that port.

You can try navigating to “Preferences > Advanced” and select “Site Domain” as the Router Mode, but if something is still listening on port 80, then Local won’t be able to use those custom domains.

For more info, see this help doc: https://localwp.com/help-docs/router-mode/

I will read about the router mode and try to do do what you said.

About the live link enquiry:
I can see the webpage over a live link in the same computer and in a tablet and mobile. I found that most of the problems are with backgroud photos. I am using wordpreess, Astra and Elementor.

Another person wrote an enquiry with the same problem

Thanks for that info! Having background images missing from Elementor does sound like the issue I’ve seen before.

If I remember correctly, Elementor has a setting called “CSS Print Method” under “Elementor > Settings > Advanced.” Can you try setting that to “Internal Embedding” and see if that helps?

What this setting basically does is tell Elementor to not write the CSS styles to file. I don’t know for sure if that will fix things, but it might help. Can you let me know how that goes?

If you see the image, I can not select “change domain”. Why?

I could not find the menu "Preferences >advanced…Where it is?
When I installed local software for the first time, it said there is a conflict, so I read the help topic and I move to localhost, but I will like to change the domain name.
Reply 2
I change the settings on Elementor to improve the live link but the same problem remain

The reason that the domain can’t be changed is that the Router Mode is set to localhost – in the screenshot, notice that it has localhost:10004 as the “Site Host”.

When using the localhost Router Mode, Local can’t control what the domain is.

Local’s Menu can be found by clicking those three lines in the upper-left corner of Local’s Window. From there, you can navigate to the “Advanced” section to find the “Router Mode” setting.

It’ important to note that you might not be able to change this to the “Site Domains” setting if there’s another application already listening on ports 80 and 443.

Local doesn’t have any way of knowing what that application might be, so you’ll need to do some investigating to figure out what was listening on that port and then deactivating that application before Local can give customized site domains.

Do you see any errors within the browser console? It would be helpful to know why the browser isn’t able to show those images.

I still have similar problems
I can log in and then say “loading”. I wait for at least 3 minutes but nothing happens
My system es windows 8.1
my local loglocal-lightning.log (255.6 KB) local-lightning.log (255.6 KB)

Thanks for that log @hrr!

I’m seeing a few errors that look something like:

{"thread":"main","errno":-4048,"code":"EPERM","syscall":"open","path":"C:\\Users\\Acer\\Local Sites\\ridingcolombiarivas\\app\\sql\\local.sql.tmp","level":"error","stack":"Error: EPERM: operation not permitted, open 'C:\\Users\\Acer\\Local Sites\\ridingcolombiarivas\\app\\sql\\local.sql.tmp'","message":"EPERM: operation not permitted, open 'C:\\Users\\Acer\\Local Sites\\ridingcolombiarivas\\app\\sql\\local.sql.tmp'","timestamp":"2020-10-02T01:22:30.523Z"}
{"thread":"main","class":"","stack":"Error: EPERM: operation not permitted, stat 'C:\\Users\\Acer\\Local Sites\\ridingcolombiarivas\\app\\sql\\local.sql.tmp'","level":"error","message":"Unable to dump database.","timestamp":"2020-10-02T01:22:55.783Z"}

as well as:

{"thread":"main","class":"Process","process":"phpCgi","level":"warn","message":"Sat Aug 29 17:02:07 2020 (3496): Fatal Error Unable to open base address file","timestamp":"2020-08-29T22:02:07.402Z"}


{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2020-08-26T21:13:24.308894Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable","timestamp":"2020-08-26T21:13:24.307Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2020-08-26T21:13:24.308929Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable","timestamp":"2020-08-26T21:13:24.308Z"}

What appears to be happening is that for some reason, Local doesn’t have the correct permissions to do what it needs to do, especially as it relates to the database.

The most likely reason is that there is some sort of antivirus preventing this sort of thing – do you have anything like that installed?

Another potential issue could be that there isn’t enough hard-drive space, or perhaps the hard-drive is getting old and is corrupting the data?

One possible thing you can try is restoring the site to a new one in Local. You can use a backup of the site, or try using the files for the site by following the steps outlined in the “Restoring From Only Local Site files” section of this help doc:

Thanks for your answer. I install the last version of local but I still have the same problems with pictures.
I install a wp plugin called “smart slider”. I can not see the photos installed with this plugin.
The first time I used the live link, the only problem that I had was the photos. This time I open the live link and I can see the home page. If I click any menu, It fail and say the following error:
Too many connections! The tunnel session ‘ts_1jWVWNbrvWqdTXgMgWbWo38nslT’ has violated the rate-limit policy of 20 connections per minute by initiating 109 connections in the last 60 seconds. Please decrease your inbound connection volume or upgrade to a paid plan for additional capacity.

The error encountered was: ERR_NGROK_702