Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error establishing a database connection on wordpress

i have a blog with wordpress but sometimes i have problem with that

i got blow error

Error establishing a database connection This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at %s. This could mean your host's database server is down.

Are you sure you have the correct username and password? Are you sure that you have typed the correct hostname? Are you sure that the database server is running? If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums

and this is my config file

define('WP_HOME','http://www.mysite.com');
define('WP_SITEURL','http://www.mysite.come');
define('DB_NAME', 'mydbname');

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

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

/** MySQL hostname */
define('DB_HOST', 'mysite.com');

why i got this error sometimes what do you think about this problem?

i contact with my admins server and they said "we dont have any problem with server and mysql service"

does my server have problem or my config have problem?

like image 934
ulduz114 Avatar asked Nov 29 '10 10:11

ulduz114


1 Answers

why i got this error sometimes what do you think about this problem?

That's the key; if it only happens sometimes, it's an intermittent issue at the webhost. The webhost needs to look in the MySQL logs and PHP logs for connection errors, timeouts, MySQL crashes, etc, anything that will point to the cause of the intermittent issues.

If you had "Error establishing a database connection" all the time, that points to a definite error you made in wp-config.php.

Tell the webhost and administrator to look at their logs to see when the MySQL server is going down and why.

If this is your own server, you need to know the OS and other details so you can search Stack Overflow for the information. Log locations vary, depending on the OS.

like image 75
markratledge Avatar answered Nov 15 '22 14:11

markratledge