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]

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

echo phpinfo(); ?>

[/php]

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 ….

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

This fixed it.

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

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