Jump to content

[SOLVED] The database selection cannot be made.


Recommended Posts

"The database selection cannot be made" error is driving me crazy.

 

I have followed the instructions as outlined. I have searched extensively for days both on google and PS forum for answers. Please pardon me is this has been asked somewhere.

 

Below are the steps I have followed:-

 

Developed Prestashop store on local machine. Link to prestashop on my local machine is http://localhost/prestashop/prestashop/

I have uploaded all the contents of my prestashop to the root "www" folder of my hosting.

I have created a database on my hosting account with same name as on my local machine via cpanel. I have also added database user with same username and password same as in my local machine.

I have exported all the tables on my database in my local machine and have imported them all into the database on my hosting account.

I have done everything according to the book but I am still getting this error "The database selection cannot be made".

 

Please can somebody point me to what I am doing wrong. Below is my config/settings.inc.php settings

 

<?php

 

define('__PS_BASE_URI__', '/');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_PS_CACHING_SYSTEM_', 'MCached');

define('_PS_CACHE_ENABLED_', '0');

define('_THEME_NAME_', 'Euro3310');

define('_DB_NAME_', 'eberach21');

define('_MYSQL_ENGINE_', 'InnoDB');

define('_DB_SERVER_', 'localhost');

define('_DB_USER_', 'eberach21_273');

define('_DB_PREFIX_', 'ps_');

define('_DB_PASSWD_', 'eke@u21B40');

define('_DB_TYPE_', 'MySQL');

define('_COOKIE_KEY_', 'xHtfBpjThtTzfpttx1FcezBgvrTaz7jgCPr9H6F70xf4UATYZUTwE5ge');

define('_COOKIE_IV_', 'hqS4C3DT');

define('_PS_CREATION_DATE_', '2012-08-15');

define('_RIJNDAEL_KEY_', 'OoNrcUbPLeOa3jJenFbBtUtmYeKe1vFY');

define('_RIJNDAEL_IV_', 'WHYarePtzBQIdR4fLxU0lA==');

define('_PS_VERSION_', '1.4.8.2');

 

?>

Link to comment
Share on other sites

Server you are trying to access is localhost.

You will have to change the following lines according to your server's credentials :

define('_DB_SERVER_', 'localhost');
define('_DB_USER_', '[YOUR DATABASE USERNAME]');
define('_DB_PREFIX_', 'ps_');
define('_DB_PASSWD_', ' [YOUR PASSWORD]');

 

 

Also, change the user's password once on you are on your database's backoffice.

Edited by Irkam (see edit history)
Link to comment
Share on other sites

I have done all that you can check with my settings.inc.php scripts as shown. On my local xamp server on my PC, it works perfectly. But on the hosted account for my domain, it give "The database selection cannot be made" error. I cant even access my Back Office online. Everything as shown below is the same as in my hosting account except for this define('__PS_BASE_URI__', '/'); which is define('__PS_BASE_URI__', '/prestashop/prestashop/'); which is the directory path in my local machine.

 

I replicated everything the way is was on my local machine on the hosting accounts server also.

<?php

 

define('__PS_BASE_URI__', '/');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_PS_CACHING_SYSTEM_', 'MCached');

define('_PS_CACHE_ENABLED_', '0');

define('_THEME_NAME_', 'Euro3310');

define('_DB_NAME_', 'eberach21');

define('_MYSQL_ENGINE_', 'InnoDB');

define('_DB_SERVER_', 'localhost');

define('_DB_USER_', 'eberach21_273');

define('_DB_PREFIX_', 'ps_');

define('_DB_PASSWD_', 'eke@u21B40');

define('_DB_TYPE_', 'MySQL');

define('_COOKIE_KEY_', 'xHtfBpjThtTzfpttx1FcezBgvrTaz7jgCPr9H6F70xf4UATYZUTwE5ge');

define('_COOKIE_IV_', 'hqS4C3DT');

define('_PS_CREATION_DATE_', '2012-08-15');

define('_RIJNDAEL_KEY_', 'OoNrcUbPLeOa3jJenFbBtUtmYeKe1vFY');

define('_RIJNDAEL_IV_', 'WHYarePtzBQIdR4fLxU0lA==');

define('_PS_VERSION_', '1.4.8.2');

Link to comment
Share on other sites

You said you gave same name to database and use same user name,

but can you check in your Cpanel maybe your hosting provider adds its own

prefixes to both.

 

And if I may say it is really not safe to post your database detail like that.

Link to comment
Share on other sites

I have done all that you can check with my settings.inc.php scripts as shown. On my local xamp server on my PC, it works perfectly. But on the hosted account for my domain, it give "The database selection cannot be made" error. I cant even access my Back Office online. Everything as shown below is the same as in my hosting account except for this define('__PS_BASE_URI__', '/'); which is define('__PS_BASE_URI__', '/prestashop/prestashop/'); which is the directory path in my local machine.

 

I replicated everything the way is was on my local machine on the hosting accounts server also.

<?php

 

define('__PS_BASE_URI__', '/');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_PS_CACHING_SYSTEM_', 'MCached');

define('_PS_CACHE_ENABLED_', '0');

define('_THEME_NAME_', 'Euro3310');

define('_DB_NAME_', 'eberach21');

define('_MYSQL_ENGINE_', 'InnoDB');

define('_DB_SERVER_', 'localhost');

define('_DB_USER_', 'eberach21_273');

define('_DB_PREFIX_', 'ps_');

define('_DB_PASSWD_', 'eke@u21B40');

define('_DB_TYPE_', 'MySQL');

define('_COOKIE_KEY_', 'xHtfBpjThtTzfpttx1FcezBgvrTaz7jgCPr9H6F70xf4UATYZUTwE5ge');

define('_COOKIE_IV_', 'hqS4C3DT');

define('_PS_CREATION_DATE_', '2012-08-15');

define('_RIJNDAEL_KEY_', 'OoNrcUbPLeOa3jJenFbBtUtmYeKe1vFY');

define('_RIJNDAEL_IV_', 'WHYarePtzBQIdR4fLxU0lA==');

define('_PS_VERSION_', '1.4.8.2');

 

 

Ideed, that's what I was talking about.

 

Unless you are developping on your local machine, _DB_SERVER_ should never be set as 'localhost'. If you are trying to host your site on a remote server with this config file, it will NEVER work. It will work locally on your local pc because it connects to localhost, your wamp/xamp server. On a remote server it will connect to another server.

So check that the user, the password, the db name AND the db server host are concording to your hosting server.

Link to comment
Share on other sites

I understand the security implication and I know how to take care of that. You are right about the prefix and I did put that into consideration. My hosting provider did put their own prefix, when I observed that, I changed the database name locally to include the prefix. I also changed the database user to include the prefix as well. Please where could I have gone wrong? Its driving me crazy.

Link to comment
Share on other sites

Does MySQL Engine have any effect?

 

I just installed prestashop from my hosting control panel to a different directory so I can study the settings script and I discovered that it has this

 

define('_MYSQL_ENGINE_', 'MyISAM');

 

while my localmachine has this

 

define('_MYSQL_ENGINE_', 'InnoDB');

 

I edited the InnoDB to MyISAM on the server and still no luck. Getting the same annoying error.

Link to comment
Share on other sites

I have just solved the lingering problem. I prestashop from my hosting account and went to study the mysql database. I discovered that after I created the database user, I did not add the user to the database I created. This is a very common mistake and I am sure a lot of people will make this same mistake.

 

The solution is thus;

 

Create a database with same name as you have on you production server (Locally as the case may be)

Create a database User as it is exactly on you local machine

Then add the new user you have created a the database users.

Remember to assign the new user all the relevant privileges.

 

This might be a case for just cpanel users. Other systems might have a different approach.

 

Irkam your question about privileges helped me. Thank you so much.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...