Wordpress error establishing a database connection

Wordpress error establishing a database connection



First create testconn.php Fill it with the actual db connection string from either wp-config.php or from the client himself.
=======
<?php
$link = mysql_connect('localhost', 'root', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
========
e.g.

http://www.domain.com/testconn.php
IF the error shows as :

------
Could not connect: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file
--------

You have to reset the password for the mysql user to at 10+ alphanumeric characters e.g. for this client I reset the password to v6dkUd26PbR4w on mysql server I adjusted with following command, furthermore also updated wp-config.php accordingly.
 
mysql> UPDATE mysql.user SET Password = PASSWORD('v6dkUd26PbR4w') WHERE user = 'testdbuser_wp';
Query OK, 1 row affected (0.01 sec)
Rows matched: 2  Changed: 1  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

Finally feel free to remove, http://domain.com/testconn.php if you want.
    • Related Articles

    • Migrating WordPress

      Make a full WordPress Transfer A WordPress migration from one hosting provider to another is an easy task if performed properly. Basically, to make a WordPress migration from one host to another consists of three parts - moving the files, moving the ...
    • Permission issues in wordpress

      If there is a permissions error in a wordpress install it's possible the php version is libphp. libphp requires 777 permissions everywhere and that's very insecure. If the version is libphp under hsphere change it to fastcgi which is more secure and ...
    • Manually Resetting Wordpress Password

      In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface. If you forget your password, WordPress has a built in recovery mechanism that uses email. But on some hosts, ...
    • WordPress

      WordPress     Install Linux: wget --no-check-certificate http://wordpress.org/latest.tar.gz Then unzip the package tar -xzvf latest.tar.gz The WordPress package will extract into a folder called wordpress in the same directory that you downloaded. ...
    • err_too_many_redirects on WordPress - Php

      How to Solve Too Many Redirects Error in WordPress? The most common misconfiguration that we have come across repeatedly is when a user has incorrect URL in WordPress Address URL or Site Address URL settings. For example, lets assume that your site’s ...