Unable to connect to database. A database error occurred while processing this request.

Permalink
I have seen this problem way too many times on the forum - now I am seeing it for myself. Site works fine on MAMP local sever. The site was upgraded to a newer version on my local server.

Things I have done -
exported and imported the database ( phpmyadmin )
Created database user
I have set all the permissions for folders to 777 ( folders mentioned in the moving a site )
Cleared all the cache files - then copied to Archive ( zip ) all files
Uploaded Archive and decompressed.
Changed config/site.php to show new changes
(top 4 defines)
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'new-username');
define('DB_PASSWORD', 'new-password');
define('DB_DATABASE', 'new-database-name');
define('PASSWORD_SALT', 'gcGvGPaIHCvoU1JYtVBSaubEHblahblahblah');

Site doesn't work ( soccerelectronics.com)
Unable to connect to database


I think that migration from local to server should be way simpler - Is there an Add-on to collect everything from local and then do clean install on server? This is very frustrating. I have done this before by doing Concrete install first then going through and re-adding all packages and importing ( drop tables ) and I have had it work before but that is a lot of work where copying the exact files should work.

Very frustrating.

INTcommunications
 
mesuva replied on at Permalink Best Answer Reply
mesuva
You've created the database user, but have you given that user access to your database?

In cPanel for example, there is a section in the database page 'Add User To Database'.
You need to make sure that the user has permission to actually access the new database.
The steps are:

- Create new database, take note of name, import dump
- Create new database user, take note of username and password
- Add the new user to the new database, giving them permissions to do everything
- Upload your files (best way is a zip of everything, and uncompress on the server)
- Edit /config/site.php with the new database name, username and pass

Migrations should feel pretty quick/short to be honest (you couldn't really do anything more automated), but I appreciate they are frustrating when they don't work!
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
I had a similar problem when migrating from a wamp server,
What worked for me was to use a concrete database backup file instead,
Try this, log into your mamp concrete site and create a database backup and when it has completed, click the download button,
This will place a copy of the backup on your hard drive,
Go to your live server and drop all tables in your current database (make a backup first) and then import the database file from your hard drive..
It worked for me, maybe it will for you,
Good Luck
wyckoff411 replied on at Permalink Reply
Do you have to create a new database and move the files or can I just modify the old one to grant access permission?
INTcommunications replied on at Permalink Reply
INTcommunications
This has been resolved - missed the step to grant user permission in the cpanel ( Added user but forgot to then add the user to the database - (this is where the database privileges are set ) also .htaccess was set for pretty urls on my local server ( different path)
Is all now working as expected.

Also - sorry about the multiple posting of this problem - The forum ajax post seems to hang on my Mac and I thought it wasn't working.


thanks for those who made suggestions. very much appreciated.

Jim Robinson