[MySQL] Install difficulties : Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)
ms at mac-specialist.com
Mon Jun 25 14:55:41 PDT 2007
This is a copy of the message I sent Ryan Schmidt.
The reason for using MacPorts in the first place is to simplify the
whole unix thing, with that in mind, why over-complicate the hierarchy.
I screwed around with the MacPorts version of MySQL for about a week
off and on, and couldn't get it running...
NOTE : While I was waiting for a reply to this problem I downloaded
the MySQL for OSX from http://www.MySQL.com, followed the simple
instructions and got it running in about 20 minutes, and within a
brief time after that I had imported all my data. They use a simple
hierarchy that works with simple instructions. I even ran the secure
install using :
and it all worked the first time...
For some reason, MacPorts uses an OVER-COMPLICATED HIERARCHY for
MySQL, yet it uses a simple and great hierarchy for APACHE2.
You can go to the MacPorts Apache2 folder and find everything you
could possibly need all in one place.
The shame is that these guys that volunteer to do all this work are
spending a great deal of time and effort to do all this, and I almost
feel like a terrible ingrate for mentioning the fact that the user
experience is probably now what they intended...
I've been working all day with the http://www.MySQL.com simple
install and using Navicat for a GUI, and I don't know if I am going
to bother to fix the MacPorts install, I've already wasted so much
time on it...
I like PostgreSQL a lot better anyway, but wanted to get MySQL
working for some of my PHP stuff...
On Jun 25, 2007, at 3:28 PM, paul beard wrote:
> I have to say that installing and running MySQL has never been
> troublefree for me.
> I find it especially frustrating when presented instructions to
> copy and paste that don't work:
> [/opt/local]# bin/mysql_install_db5
> Installing MySQL system tables...
> Filling help tables...
> To start mysqld at boot time you have to copy
> support-files/mysql.server to the right place for your system
> PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
> To do so, start the server, then issue the following commands:
> /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
> /opt/local/lib/mysql5/bin/mysqladmin -u root -h white.paulbeard.org
> password 'new-password'
> See the manual for more instructions.
> You can start the MySQL daemon with:
> cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
> You can test the MySQL daemon with mysql-test-run.pl
> cd mysql-test ; perl mysql-test-run.pl
> Please report any problems with the /opt/local/lib/mysql5/bin/
> mysqlbug script!
> The latest information about MySQL is available on the web at
> Support MySQL by buying support/licenses at http://shop.mysql.com
> (root at white.paulbeard.org)-(01:23 PM / Mon Jun 25)
> [/opt/local]# /opt/local/lib/mysql5/bin/mysqladmin -u root password
> /opt/local/lib/mysql5/bin/mysqladmin: connect to server at
> 'localhost' failed
> error: 'Can't connect to local MySQL server through socket '/opt/
> local/var/run/mysql5/mysqld.sock' (2)'
> Check that mysqld is running and that the socket: '/opt/local/var/
> run/mysql5/mysqld.sock' exists!
> It strikes me as obvious that the database server/daemon needs to
> be running before we'll be able to run commands against it, right?
> So how is that supposed to work?
> I knew there is some other incantation that runs it with the
> privileges opened up (something to do with grant tables) that I
> have used before but only after looking it up. I'm sure I can get
> it working -- I have done before -- but are people using these
> instructions and getting anywhere? I don't even see a reference to
> running the database installer, and without that you're hosed.
> Paul Beard / www.paulbeard.org/
> <paulbeard at gmail.com/paulbeard at mac.com>
THIS IS THE ORIGINAL MESSAGE, YOU CAN SKIP IT...
On Jun 24, 2007, at 11:21 PM, Ryan Schmidt wrote:
> I'm going to snip right there because you've written such a
> voluminous message that I'm having immense difficulties taking it
> all in. But as has been pointed out, /tmp/mysql.sock is not where
> the MacPorts mysql5 puts its socket. (/tmp/mysql.sock is where the
> mysql.com binary distribution puts its socket file.) Why is your
> mysql looking for the socket in /tmp/mysql.sock? Have you
> configured your my.cnf to point to that location? If so, take those
> lines out and let mysql find the socket files in the default location.
HERE'S A BRIEF VERSION OF MY MESSAGE
My message was voluminous, because I've been trying to get this to
work for several days, and had no luck getting docs that explained
the setup used by MacPorts.
NOTE : While I was waiting for this reply I downloaded the MySQL for
OSX from http://www.MySQL.com, followed the simple instructions and
got it running in about 20 minutes, and within a brief time after
that I had imported all my data.
It uses a fairly simple hierarchy:
MacPorts uses an OVER-COMPLICATED HIERARCHY for MySQL, yet it uses a
great hierarchy for Apache2.
You can go to the Apache2 folder and find everything you could
possibly need all in one place.
MacPorts appears to use several directories, which probably all need
to have the ownership/permissions set correctly :
I am sure there is a great reason for the over-complicated hierarchy
which I do not see at this point, but the standard install where all
the mySQL stuff goes in one dir seems a lot easier to deal with, even
for browsing purposes. Although as a work-around I could create a
dummy directory with aliases to all these other directories in order
to simplify the process of becoming familiar with the distributed
Setting permissions for the installations at /usr/local/mysql was
fairly simple and only involved two sets of permissions, one for the
main directory, and a different one for the data dir, and like I said
previously I got that version up and running in about 20 minutes, vs
several days that I've been trying to get the MacPorts MySQL working.
I am not trying to be ungrateful, I am just not sure why this
implementation is so over-complicated ?
/usr/local/mysql/data --> data file, which translates to --> /opt/
I didn't find any documentation on this type of setup. All the docs I
found refer to the /usr/local/mysql self contained type of installation.
I was not able to locate any documentation on what the MacPorts
implementation required, such as my.cnf, and where any of this stuff
is supposed to live.
I ask again, Is there any documentation ?
Also the log showed this :
070624 18:11:24 mysqld started
070624 18:11:24 [ERROR] /opt/local/libexec/mysqld: unknown option '-S'
070624 18:11:24 mysqld ended
070624 18:40:58 mysqld started
070624 18:40:58 [ERROR] /opt/local/libexec/mysqld: unknown option '-S'
070624 18:40:58 mysqld ended
THE FILE "mysql-test-run.pl " DOES NOT EXIST, NEITHER DOES THE DIR
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Also, has anybody documented how they got this implementation working ?
Are there any step by step docs for this implementation ?
Any ideas ?
More information about the macports-users