Post by stendek » Mon Jul 20, 2009 7:52 pm

i got problem when put database host and user...its shows Error: Could not connect to the database please make sure the database server, username and password is correct!

but i already use the correct database server/username and password.What should i do help me

thank you

Newbie

Posts

Joined
Mon Jul 20, 2009 7:51 pm

Post by toranaga8181 » Tue Jul 21, 2009 12:48 am

write database ip adress to the database host
without http or www only the ip number

Newbie

Posts

Joined
Sat Jul 18, 2009 6:10 pm

Post by stendek » Tue Jul 21, 2009 8:29 am

already try but same problem.on database host i put the ip number of my domain.is it right?

Newbie

Posts

Joined
Mon Jul 20, 2009 7:51 pm

Post by toranaga8181 » Wed Jul 22, 2009 12:34 am

I dont not. my database ip is different from my domain ip. in phpmyadmin you can see your database ip.

Newbie

Posts

Joined
Sat Jul 18, 2009 6:10 pm

Post by stendek » Wed Jul 22, 2009 1:29 pm

can u show me step by step where can i find a database host ip?

thank you

Newbie

Posts

Joined
Mon Jul 20, 2009 7:51 pm

Post by FraZeks » Fri Sep 18, 2009 7:05 am

Hello,

I'm also new to Opencart.
On instalation I had the same problem, Opencart doesn't support symbols as password, you surely generated the database password, juste generate a new using only letter and number, with the same security level.

solution: change your database password

New member

Posts

Joined
Fri Sep 18, 2009 6:57 am

Post by laserlight » Fri Oct 30, 2009 10:02 am

That really irritated me, that needs to be stated in the install txt. That your database password cannot contain any symbols and thats really lame that you cant have that security. >:(

Newbie

Posts

Joined
Fri Oct 30, 2009 10:00 am

Post by akehat » Tue Nov 03, 2009 6:00 am

I'm experiencing the same phenomenon;
After successfully installing it on my Windows box, I tried installing on my Xandros Linux notebook, but failed in step 2 of the installation; "could not connect to the DB". double & triple checked the user name & password - all is fine. Not using any special characters in my user/password/database .
When I remove the password (wether the specific user needs one or not, the message I get back is "Database does not exist!").
(Database does exist...)
I'm at lost.
TIA

Newbie

Posts

Joined
Tue Nov 03, 2009 5:36 am

Post by akehat » Wed Nov 04, 2009 2:27 am

I figured it out...
The user I was using did not have the right privileges (not sure why; maybe something wrong the way PMA creates users), and could not see the selected database.
I created a new user (manually), gave him the correct privileges, and installed the cart successfully.

Newbie

Posts

Joined
Tue Nov 03, 2009 5:36 am

Post by Alexander » Tue Dec 22, 2009 1:45 am

FraZeks wrote:Hello,

I'm also new to Opencart.
On instalation I had the same problem, Opencart doesn't support symbols as password, you surely generated the database password, juste generate a new using only letter and number, with the same security level.

solution: change your database password
Thank you, you helped me a lot.

Newbie

Posts

Joined
Fri Dec 18, 2009 6:35 pm

Post by Lat17S » Tue Dec 22, 2009 6:30 am

I've searched through the forums for all topics related to "Could not connect to database", and still haven't solved this issue. I wonder why the solution to this isn't within the install.txt file?

What I have now....

Database Host: localhost
*User: prefixed user from "Current Databases" section of cPanel
Password: blank
*Database Name: prefixed database from "Current Databases" section of cPanel
Database Prefix: blank

*Username: same as above, with or without the prefix it doesn't seem to matter
*Password: pw I assigned when I created the user in cPanel

Note the user IS added to the database. I'm on shared hosting. I tried entering my dedicated IP address for "database host" but that didn't work either. Same with entering my website URL. There are no symbols within my password.

Very frustrating first experience with OpenCart. I hope someone can provide some guidance.

Newbie

Posts

Joined
Tue Dec 22, 2009 6:20 am

Post by Tricon » Mon Jan 04, 2010 12:01 pm

I had the very same problem and just figured it out. By default, PHP looks in /var/mysql/mysql.sock for the socket to connect to MySQL on. Some MySQL installs, such as on OS X in my case, put the sock in /tmp/mysql.sock.

To resolve, edit /etc/php.ini and replace all occurrences of /var/mysql/mysql.sock with /tmp/mysql.sock.

Newbie

Posts

Joined
Mon Jan 04, 2010 11:56 am

Post by kohtut » Thu Sep 22, 2011 11:18 am

FraZeks wrote:Hello,

I'm also new to Opencart.
On instalation I had the same problem, Opencart doesn't support symbols as password, you surely generated the database password, juste generate a new using only letter and number, with the same security level.

solution: change your database password
Thank you!

Newbie

Posts

Joined
Mon Sep 05, 2011 12:11 am

Post by rumcious » Thu Dec 08, 2011 2:32 am

Just bumping this with some additional info. I just had to reinstall to a new server and had the same "Cannot Connect" error. Changed password to alpha-numerics didn't work. Additionally it's not always possible to remove the "_" (underscore) from db names because that appears to be something dependent on the host (not a user set-able value).

Turns out, for me at least, the database that Opencart wants to use has to be completely 'clean'. So try setting up a brand new database with a username of choice and alpha-numeric password (no 'special' characters), see if that helps with these stubborn instances during installation.

Newbie

Posts

Joined
Tue Oct 04, 2011 12:10 pm

Post by rinuthomas90 » Mon Dec 17, 2012 12:43 pm

Solution
1. Click on 'Check Privileges' for your databse
2. Click on 'add user'
3. Enter username, password and other privileges..
4. Submit


Go back to installation..
Enter user name and db details... Done

;)

Best Regards,
Rinu Thomas


Newbie

Posts

Joined
Mon Dec 17, 2012 12:39 pm

Post by rinuthomas90 » Mon Dec 17, 2012 12:45 pm

Solution
1. Click on 'Check Privileges' for your databse
2. Click on 'add user'
3. Enter username, password and other privileges..
4. Submit


Go back to installation..
Enter user name and db details... Done

;)

Best Regards,
Rinu Thomas


Newbie

Posts

Joined
Mon Dec 17, 2012 12:39 pm

Post by arnelzhub » Fri Dec 21, 2012 5:16 pm

Hello rinuthomas90,

Just wanted to see if you got this issue resolved or not. If you haven't, just to summarize, your database server is different from your web hosting server, right? If it were within the same server, then the setting would be "localhost", but if you're on a different server, you need to make sure to properly identify the IP of the database server and use it for the server settings. If you know the URL to your database server, you can simply go to a command line or shell and ping it and you'll see the IP.

Also, you might need to specify the port (an earlier post indicated where to edit that info). Though you may need to consult with your host for ports getting into your database server. The default port for the MySQL server is typically 3306. For our hosting service, we also require a policy to be written to allow entry through the firewall (for remote connections).

Hopefully, though, you already have the issue solved. Let us know if you're still having problems and if so, then we'll try our best to help.

Happy Holidays!

Arnelzhub
http://www.webhostinghub.com

Newbie

Posts

Joined
Thu Dec 06, 2012 7:16 am

Post by xoftmade » Wed Jan 30, 2013 4:41 am

You all are wrong, actually open cart has a bug, while putting db info it not accepting a Database password with special characters, for testing please use password with just a combination of (Alphabets + digits) it will be done ;)

Newbie

Posts

Joined
Wed Jan 30, 2013 4:38 am

Post by c47 » Wed Apr 03, 2013 10:12 pm

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.

c47
Newbie

Posts

Joined
Tue Jan 17, 2012 12:47 am

Post by butte » Thu Apr 04, 2013 12:31 pm

Your hosts will in the control panels under Databases show the critical settings for each database. The addressing must match that in server lingo; externally accessible addresses aren't that lingo. The naming of databases follows each server's own syntax and relates to account usernames on that server. For passwords use ordinary keyboard letters and numbers, no language-specific characters, and no punctuation marks, unless your server documents doing otherwise (as it probably would in some of the alphabetically different areas of the world). For user the special one named "root" is not a good choice for security reasons on a production box.

Ensure that BOTH config.php files, in their sections for http, https, directories, and database, conform EXACTLY to the present server. A common oversight springs from tiny typrogripigal errots that weren't proofread enough times.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am
Who is online

Users browsing this forum: Semrush [Bot] and 23 guests