The dreaded ‘Error establishing a database connection’

The dreaded ‘Error establishing a database connection’

I am trying to use Netbeans PHP and have a LOCAL copy of WordPress with a remote mysql database.

This was an obscure error which the following php revealed some hints.


<?php
$db = mysql_connect('1.2.3.4', 'username', 'password');
if (!$db) echo "connection failed";
else echo "connection succeeded";

echo phpinfo(); ?>

Note that the @ is NOT in front of the mysql_connect statement – this means you will see all the errors generated when something goes wrong. What it said did not fix the issue. I do NOT have control over this mySQL install (cannot see or set things in the user table)

It did not like the old password created by the script that made the WordPress installation. So to solve this, after an hour, I finally came acro

Then, our good friends at stack overflow had suggested this ….

<pre><code>SET SESSION old_passwords=FALSE;
SET PASSWORD = PASSWORD('[your password]');</code></pre>

This fixed it.

However, he continues with (I didn’t try this)

<code>define('CLIENT_LONG_PASSWORD', 1);</code>
<pre><em id="__mceDel"><code>mysql_connect('[your server]', '[your username]', '[your password]', false, CLIENT_LONG_PASSWORD);

ELB Solutions.com Inc.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.