View Full Version : Failed to connect to MySQL
greentr
December 6th, 2003, 03:46 PM
Hello,
I just did the inital installation of SquirrelCart and ran into my 1st error.
Whenever I load http://greentreegifts.com/store.php I'm getting an error message. Squirrelcart Error: Failed to connect to MySQL. Check your username, password, and sql host in your configuration.
The error msg is pretty straight forward, but I've checked everything several times and can't understand what I'm doing wrong.
I set up an empty MySQL DB called "squirrelcart", added a user/password to the "squirrelcart" database, imported the DB via phpMyAdmin through my Control Panel. (was different that the screenshoot in the SquirrelCart documentation, but similiar). I put the squirrelcart folder, store.php & home.php in my home directory and edited the config.php file.
the last thing i did was changed the first line in store.php to reflect the correct path.
Could someone give me a hand... Thanks a bunch.
My site is at http://www.greentreegifts.com
Mike
Jamie
December 6th, 2003, 04:31 PM
Hi Mike,
If you are sure that you added the MySQL user to the database, and that you have the username and password correct in the config file, then the problem might be with the sql_host variable. I would check with your host and find out if your database is on the same server as your hosting account. If it isn't, you will have to change the sql_host variable from "localhost" to the ip address or hostname of the server MySQL resides on.
Thanks,
Jame
greentr
December 6th, 2003, 05:48 PM
Hi Mike,
If you are sure that you added the MySQL user to the database, and that you have the username and password correct in the config file, then the problem might be with the sql_host variable. I would check with your host and find out if your database is on the same server as your hosting account. If it isn't, you will have to change the sql_host variable from "localhost" to the ip address or hostname of the server MySQL resides on.
Thanks,
Jame
Jamie,
Thanks for the quick response. I checked with my host, and Yes the MySQL DB is on the same server as my hosting acct.
Once I created the username via my Control Panel, my username for my hosting acct was added. (I created a username: mike, it created a username: greentr_mike). I made the change in the config.php file, but now I'm getting a different error msg. Squirrelcart Error: failed to connect to database. Check your configuration
I just gonna scratch what I've done so far & retry from the beginning. Any suggestions? Sound like a typo somewhere?
Thanks again,
Mike
greentr
December 6th, 2003, 05:54 PM
I copied this info from my MySQL Manager via my Control Panel
per the reply above, did it change the name of my DB also from squirrelcart to greentr_squirrelcart?
Databases:
greentr_squirrelcart
Users in greentr_squirrelcart
greentr_mike
Connection Strings
Perl $dbh = DBI->connect("DBI:mysql:greentr_squirrelcart:localhost","greentr_mike","<PASSWORD HERE>");
PHP $dbh=mysql_connect ("localhost", "greentr_mike", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("greentr_squirrelcart");
greentr
December 6th, 2003, 06:05 PM
Hello,
Sorry for all the replies... I think the above fixed that one prob. I changed the config.php file to reflect username: greentr_mike & db: greentr_squirrelcart.
Now when I load the page, I get the following:
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Session_Timeout FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.TEMP_Sessions' doesn't exist
Query was: SELECT * FROM TEMP_Sessions WHERE Last_Activity <= '1070737384' ORDER BY Last_Activity ASC
MySQL error: Table 'greentr_squirrelcart.Admin_Options' doesn't exist
Query was: SELECT Value FROM Admin_Options WHERE Name = "Admin Page"
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Default_Theme FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Themes' doesn't exist
Query was: SELECT Path_to_Files FROM Themes WHERE record_number = ""
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Currency_Symbol FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Weight_Symbol FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Email_Orders_To FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Customer_Service_Email FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Bread_Crumb_Seperator FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Required_Field_Indicator FROM Store_Information WHERE record_number = '1'
MySQL error: Table 'greentr_squirrelcart.Images' doesn't exist
Query was: SELECT * FROM Images WHERE Name = 'required_field_indicator'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Missing_Field_Indicator FROM Store_Information WHERE record_number = '1'
MySQL error: Table 'greentr_squirrelcart.Images' doesn't exist
Query was: SELECT * FROM Images WHERE Name = 'missing_field_indicator'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Use_Inventory_Control FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Out_of_Stock_Behavior FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Maximum_Quantity FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Do_Not_Expand_Categories FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Groups' doesn't exist
Query was: SELECT record_number FROM Groups WHERE Name = 'Store Admin'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Last_Log FROM Store_Information WHERE record_number = 1
Query Failed: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Thanks for the help,
Mike
Jamie
December 7th, 2003, 01:30 PM
Hi Mike,
Did you import the squirrelcart.sql file into the database?
Thanks,
Jamie
greentr
December 7th, 2003, 03:57 PM
Hello,
Yes, I imported the squirrelcart.sql file the first time.
I just finished re-installing from scratch. Everything went smooth, but when I pull up http://www.greentreegifts.com/store.php, I'm getting:
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Session_Timeout FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.TEMP_Sessions' doesn't exist
Query was: SELECT * FROM TEMP_Sessions WHERE Last_Activity <= '1070815633' ORDER BY Last_Activity ASC
MySQL error: Table 'greentr_squirrelcart.Admin_Options' doesn't exist
Query was: SELECT Value FROM Admin_Options WHERE Name = "Admin Page"
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Default_Theme FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Themes' doesn't exist
Query was: SELECT Path_to_Files FROM Themes WHERE record_number = ""
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Currency_Symbol FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Weight_Symbol FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Email_Orders_To FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Customer_Service_Email FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Bread_Crumb_Seperator FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Required_Field_Indicator FROM Store_Information WHERE record_number = '1'
MySQL error: Table 'greentr_squirrelcart.Images' doesn't exist
Query was: SELECT * FROM Images WHERE Name = 'required_field_indicator'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Missing_Field_Indicator FROM Store_Information WHERE record_number = '1'
MySQL error: Table 'greentr_squirrelcart.Images' doesn't exist
Query was: SELECT * FROM Images WHERE Name = 'missing_field_indicator'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Use_Inventory_Control FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Out_of_Stock_Behavior FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Maximum_Quantity FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Do_Not_Expand_Categories FROM Store_Information WHERE record_number = 1
MySQL error: Table 'greentr_squirrelcart.Groups' doesn't exist
Query was: SELECT record_number FROM Groups WHERE Name = 'Store Admin'
MySQL error: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Query was: SELECT Last_Log FROM Store_Information WHERE record_number = 1
Query Failed: Table 'greentr_squirrelcart.Store_Information' doesn't exist
Not for sure what I'm doing wrong. I've attached a copy of my store.php & config.php files & a print screen from MySQL Manager & phpMyAdmin via my Control Panel.
Thanks again for the help,
Mike
Rich
December 10th, 2003, 11:11 PM
Responded via the help desk.
finepix
March 14th, 2004, 05:17 PM
Responded via the help desk.
Hi Rich,
I am having the same initial problem as this guy posted:
Squirrelcart Error: Failed to connect to MySQL. Check your username, password, and sql host in your configuration.
Please advise as to what you think I should do.
Thanks.
Rich
March 14th, 2004, 07:23 PM
Hi Rich,
I am having the same initial problem as this guy posted:
Squirrelcart Error: Failed to connect to MySQL. Check your username, password, and sql host in your configuration.
Please advise as to what you think I should do.
Thanks.finepix resolved this before we could respond in the help desk.
(Glad you figured it out! :squirrel: )
plato
April 7th, 2004, 04:05 PM
Would be nice if someone posted the answer here. I am having the same problem and haven't heard from help desk in over 24 hours.
Rich
April 7th, 2004, 04:51 PM
There are a lot of things that can cause this type of issue, so the answer for greentr and finepix (which were different answers) wouldn't neccessarily be the resolution you need, in fact it wasn't.
I've responded to your help desk ticket (and email). If you did not receive a response via email you can log in to the help desk for the resolution.
Vytas
October 20th, 2005, 09:43 PM
I have been messing with MySQL installations(upgrading, downgrading), so when I got that message the answer was this:
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
So I reseted the password for the user accessing squirrelcart database.
Full article is here:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
ALMO926
December 18th, 2005, 04:05 AM
I'm having problems connecting to my mysql server. I checked the config.php file to see if I had a bad user name or bad database name but everything is ok. I called my host provider and ask what was the host name to my mysql server and they told me it was "localhost". I cant connect using localhost eventhough the technicial support guy said that he was able to connect to the server. He suggested that there might be a coding problem in my config.php file. What I did then was to upload a new config.php file and input all the connection information from scrach. I still get the same error which is this "Error: Failed to connect to MySQL. Check your username, password, and sql host in your configuration". I'm at lost for whats going on Please help!! My web site is " www.Buyme4less.com" and you can see the error message their. I'm using the newest version of squirrel cart.
Jamie
December 18th, 2005, 02:50 PM
The only things that will cause this error are:
- an incorrect setting for $sql_host
- an incorrect setting for $sql_username
- an incorrect setting for $sql_password
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.