Unable to connect to your database server | Unable to select the database
Posted: 19 July 2008 09:12 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  29
Joined  07-15-2008

Okay, I’ve done some pretty extensive reading in the forums without luck fixing this problem. On install I am getting the following errors:

  1. Unable to connect to your database server.
  2. Unable to select the database

I am installing an instance of EE Core as a test before migrating from Wordpress. I am installing core 1.6.4 onto the localhost on my HD as a testing environment, so I don’t have a hosting provider to call to check my server settings. Here are the basics of my system:

Mac OS 10.5
MySQL 5.0.45
PHP 5.2.5
Apache 2.0
EE Core 1.6.4

Please note I am currently running an instance of Wordpress on my localhost without error.

I filled out the dbtest.php and received the following response:

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (2) in /Library/WebServer/Documents/ee/admin/utilities/dbtest.php on line 12

Unable to connect to your database server


Warning: mysql_select_db() [function.mysql-select-db]: Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (2) in /Library/WebServer/Documents/ee/admin/utilities/dbtest.php on line 28

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /Library/WebServer/Documents/ee/admin/utilities/dbtest.php on line 28
Unable to select your database

I have checked and double checked my usernames and passwords without change.
ensured there were no “$” in my passwords
changed databases just in case there was some kind of corruption

What can I try next to get up and running? Thank you for any help you can provide.

 Signature 

Brian Hull
Independent Web Designer
Second Lamppost

Profile
 
 
Posted: 19 July 2008 11:08 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  436
Joined  02-02-2006

It sounds like an incorrect path to the mysql.sock and PHP isn’t seeing MySQL. A possible fix is to to edit your php.ini file and change the value of

mysql.default_socket

to /tmp/mysql.sock so it looks like

mysql.default_socket = /tmp/mysql.sock

Let me know if you need more details on how to do that.

 Signature 

Learn EE step-by-step with the ExpressionEngine Screencasts

Ryan Irelan

Profile
 
 
Posted: 20 July 2008 08:27 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  29
Joined  07-15-2008

Thanks for the quick response Ryan. I had a similar problem a while back when setting up my Wordpress testing server, but have corrected it and Wordpress runs fine now. Since Wordpress works on the same server (albeit a different database) wouldn’t that indicate that PHP and MySQL are interacting just fine?

I hesitate to edit my PHP settings because I use Wordpress regularly to maintain and develop client sites and can’t afford to disturb that flow.

Any thoughts? Thanks for your help.

 Signature 

Brian Hull
Independent Web Designer
Second Lamppost

Profile
 
 
Posted: 06 August 2008 07:56 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  08-06-2008

I had the same issue on my MacBook Pro running EE locally. Firstly check the connection with EE wizard at http://expressionengine.com/docs/requirements.html

Then if you had the same issue as me…

Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (2)

Read this article on Apple discussion boards.

http://discussions.apple.com/thread.jspa?messageID=5059320

This fixed my connection problems.  Hope this helps.

Profile
 
 
Posted: 06 August 2008 09:12 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Avatar
Total Posts:  29
Joined  07-15-2008

Thanks for the link Spindigg. I’ll take a look at it to see if I can get that main server up and running smoothly. I got so frustrated I just installed MAMP and it seems to be doing the job just fine.

Once I get my own EE site up and running I may feature a few how-to’s on running a local test server, because the resources I found seemed to be fairly limited. Hopefully that will help the next person with these same issues.

 Signature 

Brian Hull
Independent Web Designer
Second Lamppost

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64937 Total Logged-in Users: 66
Total Topics: 81906 Total Anonymous Users: 36
Total Replies: 440295 Total Guests: 315
Total Posts: 522201    
Members ( View Memberlist )