Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Upgrade to OS X 10.9 and Server 3 has lost connection to MySQL, how do I reconnect it?

Having just upgraded to OSX 10.9 and then having to upgrade to Server 3 (so not quite the free upgrade 😟) I'm now faced with not being able to access any of my local websites that use MySQL databases.


The MySQL databases are still there and running (I can use Workbench okay) but not accessible under the server website (http://imacserver.local/).


When I installed server 2.x I had to manually change a file to point to MySQL, I think it was either httpd.conf or php.ini. Which ever file it was the upgrade to server 3 has lost this setting and I can't locate the notes on how to find it or what settings to use.


Anybody out there encountered the same problem?


And if yes, how did you fix it?


Thanks in advance.

OSX Server 3-OTHER, OS X Mavericks (10.9)

Posted on Oct 23, 2013 3:19 PM

Reply
14 replies

Oct 23, 2013 11:28 PM in response to haykong

Hi


I'm getting the " #2002 Cannot log in to the MySQL server " error with phpMyAdmin.


PHP is working quite happily (5.4.17) but none of my local sites driven by MySQL work - all the data is still in MySQL (checked with workbench).


When I installed Server 2.2.x on OS X 10.8 (Mountain Lion) it didn't come with MySQL and I had to install this separately and then change one of the Server files to point to it.


This link (http://support.apple.com/kb/HT4844) explains about using MySQL with the Lion Server I assume that I need to do the same for the Mavericks server, since upgrading to 10.9?


The problem is I can't find /etc/php.ini for the Mavericks server - where is it?

The only php.ini files I can locate using Finder and a Spotlight search are from some old WAMP files (backed up from an old PC).


Thanks in advance

Oct 25, 2013 2:25 AM in response to michalmaria

In the end I found out, that in my case the GRANT tables were not transfered correctly to the new MySQL installation — that's why it didn't work in the first place. Everything works as expected now — but I did edit the php.ini file with the socket and port defaults. You can check your PHP install by runing


php -i | grep mysql


In my case it says


(snip)

mysql.default_port => 3306 => 3306
mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

(snip)

mysqli.default_socket => /tmp/mysql.sock => /tmp/mysql.sock

(snip)

pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.soc

Oct 25, 2013 1:31 PM in response to michalmaria

Hi

Thanks for the help so far, I've followed all of the above to no avail.

In addition my phpinfo() file states that both MySQL and MySQLi are enabled.

mysqli.default_port 3306 but for the mysql equivilent there is no value.


I've tried editing the php.ini file at Library/Server/Web/Config/php/php.ini

As it states that this takes precedence over settings in /etc/php.ini - the existance of this is also confirmed in phpinfo(). However no matter what I put here makes no difference, regardless of how many times I re-start the server & mysql - even re-booting makes no difference.


If I can get to /etc/php.ini I should be able to check and edit the location of MySQL.

I know its a hidden file, in 10.8 Mountain Lion I simply set finder to search for invisible files and I found it but this doesn't work in 10.9 Mavericks.


Any suggestions?

Nov 3, 2013 1:52 AM in response to chandrashaker

Hi

Been on holiday for a week hence the delayed response.


The basic problem (at the moment) is that I can't access the php.ini file to edit it (or check it).


Running php -i | grep php.ini in Terminal and the details in phpinfo(); both confirm that the loaded configuration file is at: /etc/php.ini


However, no matter how I try to search/navigate to this file I simply can't get to it. It appears to be hidden from view/access by mere mortals within OSX 10.9.


How can I either make this visible and/or does anyone know the full (root) path to the file so that I can try to navigate to it directly.


Incidentally, the 'private' folder is so private even that isn't visible 😟

Nov 3, 2013 5:05 AM in response to haykong

Hi haykong


The holiday helped clear the brain... realised that I had been asking the wrong question all along... should have been 'how do I get access to my hidden files?'


Found an app at: http://www.northernspysoftware.com/software/invisible which did the trick (probably similar to TinkerTool).


Now have access to hidden files and importantly the original php.ini file (the server upgrade backed it up). All I then had to do was copy the old paths into the php.ini override file at Library/Server/Web/Config/php/php.ini (this is visible without having to muck about)


For any one who has installed MySQL directly with the standard settings here are mine (added to the ini file above):


; set path to correct MySQL

pdo_mysql.default_socket=/tmp/mysql.sock

mysql.default_socket=/tmp/mysql.sock

mysqli.default_socket=/tmp/mysql.sock


A quick reboot and everything is back to normal 🙂


Thanks to everyone who tried to help.

Nov 11, 2013 4:16 PM in response to GaryE50

There is a bug in some version of MySQL. It binds MySQL to the ipv6 localhost first, so using "localhost" as a hostname trys connecting to ::1 instead of 127.0.0.1. The thing I had to do was change my websites from using 'localhost' to using the ip 127.0.0.1. That fixed it so that my sites could once again access the databases.


-Cameron

Jan 1, 2014 12:15 AM in response to GaryE50

This worked for me: 🙂


I am running Mavericks and OS X Server 3.


I installed MySQL mysql-5.6.15-osx10.7-x86_64


I opened the Macintosh HD > Library > Server > Web > Config > php > php.ini file in TextWrangler


I added these lines of code...


; set path to correct MySQL

pdo_mysql.default_socket=/tmp/mysql.sock

mysql.default_socket=/tmp/mysql.sock

mysqli.default_socket=/tmp/mysql.sock


I saved the file and rebooted the Server.


PHP/MySQL is now working.

Upgrade to OS X 10.9 and Server 3 has lost connection to MySQL, how do I reconnect it?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.