Error establishing a database connection FULL DETAIL
Posted by: lopata (---.cgn.optinet.hr)
Date: October 30, 2017 08:01PM

Hello fellas,

I know there are many topic on this subject, but I have found out no answer to my problems.

So here it goes.

I have made my new project on wampserver on my local machine, and started building the site.

Followed all the steps, and have made my text book folder "system" in "www" directory and my database test_db.

Now, after some time, I tried to login to my wampserver and I got the famous "Error establishing a database connection"

Ok, I have had this problem once, and I fixed it, it was a simple path error, so no worries there.

Well now, I have a major shitstorm as my whole project is in jeopardy, as none of the solutions works.


Here is my WP-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'test_db');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

I can connect to my myphpadmin and see that my database is ok. My user is root and pass is blank.


In wp_options my paths looks good.


I tried to add to my wp-admin.php "define('WP_ALLOW_REPAIR', true);" but that does not work anymore. The same error appears.


Looked in hosts files for possible errors and nothign wrong. Pingled localhost and got a reply.

Here it gets funny.

I tried to create new database, and copy my wordpress dircetory to my new folder/database, but after inital making of new database, I cant install wordpress as it wont connect to my new database, which is empty from the moment iI made it. Which should be ok.

Im stuck here folks, and need assistance. Is there a captain here to help me out.


Thank you

Marko



Edited 1 time(s). Last edit at 10/30/2017 08:19PM by lopata.

Options: ReplyQuote
Re: Error establishing a database connection FULL DETAIL
Posted by: RiggsFolly (Moderator)
Date: October 31, 2017 09:46AM

Please can we start by asking you to answer ALL the questions mentioned on READ (and answer) BEFORE YOU ASK A QUESTION

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote
Re: Error establishing a database connection FULL DETAIL
Posted by: lopata (---.dsl.optinet.hr)
Date: October 31, 2017 09:28PM

Thank you for quick reply.

Ok, lets do this:

1- Win7 Service pack1 64Bit

2- Wampserver 3.0.6 64 bit

3- Apache 2.4.23

4- PhP 5.6.25

5- MySql 5.7.14

6- Green

etc/hosts

# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost

8- Yes, access to localhost is listed in path in browser
8a- No errors

9- YES

10- No errors

11- Avira antivirus

12- C:\Wamp64 (default instalation dir)

13- No virtual hosts


WP-CONFIG

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'test_db');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');





The only error I receive is when I try to connect to my wordpress page.

"Error establishing a database connection"

Nothing worked so far.

My quesion is, where do I edit the login credentials, as I cant enter them anywhere. Or, my database seems to have issues, so I need to repair it.

Also, is there a chance to make a clean install on new database and restore wordpress folder to restore my website back on. Its important to not to lose my work. Database is not important as I only have my login and nothing else.





Looking forward to hear some answers.



Edited 1 time(s). Last edit at 10/31/2017 09:33PM by lopata.

Options: ReplyQuote
Re: Error establishing a database connection FULL DETAIL
Posted by: RiggsFolly (Moderator)
Date: November 01, 2017 01:02AM

Hi you do realise that almost anything you do in WordPress is storing things on its database?

Always create a Virtual Host to match your existing or intended live hosting site

Your wp-config.php file look fine, but then we are not WordPress experts. We cannot support every app out there.

You make it sound like you have had this WP site working for some time and now it is broken, is that right?

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote


Sorry, only registered users may post in this forum.