Page 2 of 2
Re: Could not connect to database
Posted: Thu Apr 11, 2013 4:50 am
by gilangramdhan
c47 wrote:Here's the solution for cases when changing MySQL password is not an option:
Open
/install/controller/step_3.php and change (line 218):
Code: Select all
if (!$connection = @mysql_connect($this->request->post['db_host'], $this->request->post['db_user'], $this->request->post['db_password'])) {
to this
Code: Select all
if (!$connection = @mysql_connect($this->request->post['db_host'], $this->request->post['db_user'], 'PASSWORD')) {
where PASSWORD is of course to be replaced by your crazy non-standard password.
Now open
/install/model/install.php and change (line 4):
Code: Select all
$db = new DB('mysql', $data['db_host'], $data['db_user'], $data['db_password'], $data['db_name']);
to this
Code: Select all
$db = new DB('mysql', $data['db_host'], $data['db_user'], 'PASSWORD', $data['db_name']);
again, replace PASSWORD by your MySQL password.
Now do the step 3 again - refreshing it will probably do the trick.
Installation should now finish and you are invited to visit your online shop or administration. Not so fast!
Open both
/config.php and
/admin/config.php. Passwords in both files probably look something like this:
Code: Select all
define('DB_PASSWORD', 'my<crazypassword&');
Some special characters like & or < got converted into their HTML-safe counterparts. Replace those mutant passwords in both files with the real ones.
Don't forget to delete
/install directory!
Now have a beer.
Thanks... this work. maybe need a lot of time if do not find this
Re: Could not connect to database
Posted: Fri May 10, 2013 2:53 am
by TomRichter
GODADDY _ RESOLUTION (everything can be found in: MYSQL - DATABASE - DETAILS ) !!
Database Driver: MySQL
DATABASE HOST : (CHANGE FROM LOCAL HOST TO HOSTNAME - found in database details)
User: database name and username
Password: Yourpassword (case sensitive)
Database name: database name and username
Prefix : doesnt matter
GOOD LUCK
Re: Could not connect to database
Posted: Wed Sep 10, 2014 2:45 pm
by etarahan
Hi every one
Im installing quickstart for my opencart theme but in step 3 i receive this message: Error: Could not connect to the database please make sure the database server, username and password is correct!
I did all above to solve the problem but none of them solved the problem!!
Can any one help me???
Re: Could not connect to database
Posted: Sat Sep 27, 2014 9:32 am
by Randem
On GoDaddy with the new cPanel X; you need to be careful to follow these undocumented steps:
1 - Go to MySQL Databases
2 - Create your Database (If it has not already been created)
3 - Go down to MySQL Users Add New User
4 - Add in your User name and Password. The user name MUST be in Caps only. If you use lowercase letters they will be converted to uppercase and you will not be able to log in using the name without all caps.
(Godaddy states the password needs to be less than 8 characters) - Did not test this...
(OpenCart does not allow ANY special characters in the password, only letters and numbers)
5 - Click Create User.
6 - Go to Add User To Database to select the user then click Add. This will bring up a screen where you can add permissions to the user. You will not be able to connect to the database without doing this!
7 - Continue your OpenCart installation
Took a while to figure this out but it will work. Hopefully both GoDaddy and OpenCart will update their documentation to reflect this.
Re: Could not connect to database
Posted: Fri Nov 07, 2014 8:04 am
by omer1
Wanted to add some info. While creating user for DB, use local host. And enter local host in host filed during open cart installation. Worked for me..
Re: Could not connect to database
Posted: Mon Nov 04, 2019 11:34 pm
by waynec444
I realize that this is a very old thread but I found out the problem for me. Maybe it will help others.
A call to my hosting company did the trick. The problem was on their end.