Jump to content

cant connect to database using this method


jimmi8

Recommended Posts

HI,

Ive just re-installed mac os x on my mac. This time round i decided to install php ,apache and mysql myself whereas before i had a version of mamp runnning. The set up went fine and i have all three running.

The problem that im getting now is that a script i was using to connect to my database is no longer working...its named mysqlconnect.php. Here it is:

[code]
// Set the database access information as constants.
DEFINE ('DB_USER', 'root');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'databasename');

// Make the connnection and then select the database.
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db (DB_NAME);
?>
[/code]
Now i was using require_once(mysql_connect.php) in my scripts everytime i needed the above connect info.

Now when i try to access pages containing this require_once i get this message:

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /Users/pathto/pathto/mysql_connect.php on line 12

Now i dont know what to do at all. I have the latest version of sql running and i have the default php and apache thats bundeled with mac osx 4.2. Any ideas what i need to do?
ok,

so heres the reason why just in case someone stumbles accross this with the same problem ( i know ive got a lot of help in the past from other peoples threads)

I installed/enabled apache and php thats bundled with osx. The version of php that comes with osx is 4.3 which deals with passwords on the database differently than version 5 does.

the following article explains it in full. I just had to go in to my terminal and set a new password for my username, preceding it with OLD_PASSWORD. The other option would be to update my php but ive had enough fun for one day already!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.