Page 1 of 1

Could not connect to database

Posted: Tue Mar 28, 2006 3:00 pm
by apesaga
Hello,

I'm having a few problems getting CMS made simple installed.

I'm using a Windows 2003 box with PHP 4.4.2 and MySql 4.1.18

CMS Made Simple version 0[1].12.1 (?)

I get to the stage where it tries to create the database tables and get the dreaded

"Could not connect to database. Verify that username and password are correct, and that the user has access to the given database."

I followed the instructions on the page, where it says to log into MySql from a console and run the two commands. I checked in MySql Administrator and the user has been created and does have permissions on the CMS database.

I noticed a few people have had this problem before, but no-one has actually posted what they did get fix it!

I have even tried using the root account but that gave me the same error.

Can someone please share with me the secret to getting past this stage?

Many thanks

Re: Could not connect to database

Posted: Tue Mar 28, 2006 3:24 pm
by calguy1000
If you have shell access to the computer, try typing this:

mysql -U -P

it should prompt you for the password,

and if you get in, then you know it's not a problem with mysql, but rather with your settings in the config.php file.

Re: Could not connect to database

Posted: Wed Mar 29, 2006 8:19 am
by apesaga
I fixed the problem.

It turned out to be (and I should have seen this coming, but I was tired yesterday) the well documented problem connecting certain versions of PHP to new versions of MySql.

Apparently the password hashing algorithm was modified in MySql 4.1 and this can lead to problems when clients (in this case PHP) try to connect using the old algorithm.

I fixed it by telling my installation of MySql to allow the old style passwords (add the line old-passwords to my.ini). This half solved the problem, but when I created the cms_user account it assigned it a new style password so I got the "cannot connect" error again.

I then ran a query which used the old_password('password') function to update the cms_user password in the users table and assign it an old style password. Then everything worked ok.

I thought I'd post this in case anyone else has the same problem.

Re: Could not connect to database

Posted: Wed Apr 12, 2006 10:59 pm
by Sub_Kovert
apesaga thank you so much you are a starĀ  :)

- I have been trying to sort this out for over a week now and finally managed to get it up and running tonight.

I love this software already - goodbye to the ASP and MSSQL stuff I have used before

Re: Could not connect to database

Posted: Thu Jul 05, 2007 6:10 pm
by oxopo
apesaga wrote: I fixed the problem.

It turned out to be (and I should have seen this coming, but I was tired yesterday) the well documented problem connecting certain versions of PHP to new versions of MySql.

Apparently the password hashing algorithm was modified in MySql 4.1 and this can lead to problems when clients (in this case PHP) try to connect using the old algorithm.

I fixed it by telling my installation of MySql to allow the old style passwords (add the line old-passwords to my.ini). This half solved the problem, but when I created the cms_user account it assigned it a new style password so I got the "cannot connect" error again.

I then ran a query which used the old_password('password') function to update the cms_user password in the users table and assign it an old style password. Then everything worked ok.

I thought I'd post this in case anyone else has the same problem.

how do i do the query part ?