Page 1 of 1

PHP : could not connect to database

PostPosted: 22. January 2008 23:14
by cb154
Hi
I have searched this site but to no avail. I have recently installed XAMPLITE 1.6.5 however once installed and my site moved over into the htdocs area all is well. upon a reboot of my pc i get

phpBB : Critical Error

Could not connect to the database

i am guessing it is a password issue somewhere. has anyone else come across this ?

PostPosted: 23. January 2008 00:05
by Izzy
Not enough detail to work with.

What have you done and/or checked already?

Just moving a directory with a site that has a database is not enough to make it work.

Did you check that you have a phpBB database set up correctly using phpMyAdmin and is MySQL running?

Did you check the phpBB configuration reflects the new location and database details?

What do you see when you run http://localhost/xampp/status.php ?

Any clues in the apache error.log file?

PostPosted: 23. January 2008 23:38
by cb154
apologies not enough infor but this is the first time i have moved a board.

before i was useing the foxserv local host for development but now using xampplite. nothing in the apache log as a clue. i agree just moving it is not enough and that is not what i meant. i moved all the files over but used the export / import on the database.

i exported my MYSQL database then re imported into the XAMPP. i can see the database no problem and the apache server and phpmyadmin all works. it's just that when i launch my site from the index.php page i get the error. i use the config.php as i can login to my board from my main site and use the cookie to remember who i am logged in as. it just will not connect. i still believe it is a permission issue more than anything else or a config i have missed. when i moved everything over i used this as a guide

http://phpbbacademy.com/community/viewt ... =62&t=4516

PostPosted: 24. January 2008 01:09
by Izzy
Because you have had another instance of MySQL previously installed, perhaps as a service that has not been removed from the registry when you uninstalled it, try the MySQL fix in this thread:
http://community.apachefriends.org/f/viewtopi ... 772#113772

Also check the script's config file is configured correctly with the database, user, password and host entries that match those in the phpMyAdmin entries and that the correct permissions for the user for the database are correct in phpMyAdmin for your database.

It is not usually enough just to import the data into the database but that the database has to be created and the user credentials correctly set first before importing so that imported data and the database can be accessed.

Did you create a database with a user for that database and a password for that user using the localhost for your script before importing the data?

These credentials are what you enter in your script's config file in the database section.


I have just read the page you linked to and this quote is very relevant in your case
If you still get the error: Cannot connect to database then the changes you've made to the config file arent correct. Please check if these settings are all correct.
... and I add to this, make sure you have correctly created a new database (missing in the instructions - they assume your are moving to a new location and are using the old database) for your script with the correct credentials and set those in your script's configuration - any deviation from this procedure will cause errors.