Error establishing a database connection
-
I am trying to match wp-config.php with the database fields phpMyAdmin
When I try to open wp-admin Iget
Error establishing a database connection
I am trying to understand where the Database username is established as a database field
Seems like it could be from several fields in the table wp_users at the moment these fields all have adminas the entry
user_login = admin
user nicename = admin
display_name = admin
I hope my question is clear.
Many thanks
John HThe page I need help with: [log in to see the link]
-
Hey @johnhardy ,
Could you please share me the following details :
define('DB_NAME', '…');
define('DB_USER', '…');
define('DB_HOST', 'localhost');Then, open phpMyAdmin and go to User accounts, look for the user named exactly as your DB_USER and host as “localhost”. If It exists then drop me the details related to it.
Hi,
This is probably due to wrong combination of DB_USER and DB_PASSWORD. You have to double check the values.
Please note: These values are SQL settings and not from users metadata in wp_options such as user_login, user_nicename, display name etc..
Cheers!
It’s been a while the last time I used phpMyAdmin but you can check this YouTube video tutorial on how to find or reset your MySQL username and password: https://www.youtube.com/shorts/wLHGTvhw-lw
Check it out and see if that can help you in your local
Cheers!
I thank you all for your answers, very helpful.
I did by mistake send these details by email and I see this has not arrived and I now realise that this is not preferred.I can enter the text OK but cannot see how to include some images. Can someone please explain.
Many thanks
John H
Hi,
Sorry but it’s bit confusing. Is your database issue fixed now? I assume there’s no more support needed there?
I can enter the text OK but cannot see how to include some images. Can someone please explain.– Can you give us more details? Are you referring to a post, a page, or something else?Cheers!
@johnhardy I think you might have replied to ’email’ notification in your inbox. Yes that is not preferred.
Also, for attaching images in this thread let me guide you.
Step 1: On top left you will see a blue ‘+’ button, click on it and select image block.

Step 2: Now you will be prompted by that image block to insert an URL.
Step 3: Go to Free Image Hosting and upload the required images that you wish to attach in thread.

Step 4: Copy the CDN URL like this.

Step 5: Come back to this thread, Step number 1 and insert the copied URL. Your image will be inserted.
If you need any further help, do let me know.
Thanks.Re:
“I can enter the text OK but cannot see how to include images.
I took some images as requested to send but could not see how to include these in this document. Can someone please explain how to include an image with this document”. I have not heard anything yet regarding the problems I have.
The images are quite important as they show the problems.
Sorry I was not clearer.
=========================================
As my original query is overly wide for this document I am pasting it below slimmed down a little to make the viewing easier.
Copied from the Top ———————–
I am trying to match wp-config.php with the database fields in phpMyAdmin
When I try to open wp-admin I get
Error establishing a database connection
I am trying to understand where the Database username is established as a database field.
Seems like it could be from several fields in the table wp_users at the moment these fields all have admin as the entry
user_login = admin
user nicename = admin
display_name = admin
I hope this helps, regardsJohn H
Hello,
Thanks for all of the help
I have uploaded the images to ImageKit.io I assume I have to download these to this thread but I cannot see a way to do this. Am I on the right track please?Thank you
John HHey @johnhardy ,
You can insert the images to this thread by simply going to image ImageKit.io and click on the option “Copy Direct CDN URL”.

Now you have a link on your clipboard, that you can insert here the following way. Click on the Blue + icon on your editor and add an image block.

After you add an image block you will see an option to “Insert URL” like this.

Simply paste the CDN URL that you just copied from imagekit. Your image will be inserted in this thread.
Hello Pranjal Pratap Singh and thanks for this information
I was expecting an image to appear but perhaps this is correct.
The url seems to work OK
This is really a test image to make sure I am getting the method of attaching the required image correct.I will send the others when I here from you.
Regards
John H
Hey @johnhardy,
I see your user and localhost now. Can you paste the following code in wp-config.php and replace your password with your own user password.
/** Database username */
define( 'DB_USER', 'root' );
/** Database password */
define( 'DB_PASSWORD', 'your_password' );
/** Database hostname */
define( 'DB_HOST', 'localhost' );In case, you don’t remember password for your user root. Use one of the following code to change your password.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
FLUSH PRIVILEGES;If above doesn’t work then try this one.
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');Many thanks,
Re “In case, you don’t remember password for your user root. Use one of the following code to change your password”Where or what do I open to set the query please?
Thanks again
John HHey @johnhardy ,
Here’s how you do it.
Step 1: Go to your phpmyadmin.

Step 2: Go to SQL tab.

Step 3: Enter the SQL query that I gave you to reset your password for the username ‘root’.

Step 4: At the bottom-right side you will see a button that says “Go”. Click on it to execute your query.

Hello,
I have to hang my head in shame.
I do not know why but I have lost access to phpmyadmin
I use http://localhost:8081/phpmyadmin/ and get
This site can’t be reached localhost refused to connect.
Try: Checking the connection
Checking the proxy and the firewallERR_CONNECTION_REFUSED
Regards
John H
Hey @johnhardy ,
Could you please confirm if your address is http://localhost:8080/phpmyadmin/ ( 8080 ) and not (8081) ?
Regards
The topic ‘Error establishing a database connection’ is closed to new replies.