[MySQL] Install difficulties : Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2)
Ryan Schmidt
ryandesign at macports.org
Sun Jun 24 23:38:33 PDT 2007
On Jun 25, 2007, at 00:02, Bill Hernandez wrote:
> 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. While I was waiting for this reply I
> downloaded the MySQL for OSX from MySQL.com 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:
>
> /usr/local/mysql
> /usr/local/mysql/data
>
> MacPorts appears to use several directories, which probably all
> need to have the ownership/permissions set correctly :
>
> /opt/local/bin/mysql5
> /opt/local/etc/mysql5
> /opt/local/include/mysql5
> /opt/local/lib/mysql5
> /opt/local/share/mysql5
> /opt/local/var/db/mysql5
> /opt/local/var/run/mysql5
>
> 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 contents.
I don't know why the MacPorts mysql5 uses a different hierarchy but
it also has never really concerned me. It shouldn't really matter one
way or the other. MacPorts takes care of setting the permissions
correctly, and you don't really need to know what all is in the
package. In case you're curious, though, the command "port contents
mysql5" will show you.
> 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 ?
I don't know what's complicated. All you should need to do to install
mysql5 using MacPorts is:
sudo port install mysql5 +server
When it's done compiling and installing, it will output instructions
for setting up the initial database and starting the server using
launchctl.
> /usr/local/mysql
> /usr/local/mysql/data --> data file, which translates to --> /
> opt/local/var/db/mysql5
>
> 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.
The my.cnf goes in /opt/local/etc/mysql5 but it should be
optional.... mine contains:
[mysqld]
skip-networking
pid-file=/opt/local/var/run/mysql5/mysqld.pid
log-error=/opt/local/var/log/mysql5/mysqld.err
log-slow-queries=/opt/local/var/log/mysql5/slow_queries.log
datadir=/Users/rschmidt/mysql/data
bind-address=127.0.0.1
lower_case_table_names=2
default-table-type=InnoDB
query_cache_size=32M
I happen to like storing my databases in my home directory instead of
burried under /opt/local but you can take that out if you don't mind
the default db storage location.
I think storing the PID file in /opt/local/var/run/mysql5 and the
logs in /opt/local/var/log/mysql5 may have been local modifications
of mine... I think I didn't find it logical to have those files in
the database directory so I moved them. You may need to first create
those directories and set their permissions, if you want to use that
layout.
> I ask again, Is there any documentation ?
I'm not aware of any, but I also wasn't aware of any need for any
documentation of this port. Or rather, the MacPorts project doesn't
really maintain any documentation on any specific port.... just on
MacPorts infrastructure as a whole. I guess we could make wiki pages
for specific ports.... come to think of it I think there are some for
some of Gnome....
But I think the goal should be that every port is easy enough to
figure out just by installing it. If we need to print additional
instructions to the user after the port is installed, then we should
do that.
> Also the log showed this :
>
> /opt/local/var/db/mysql5/my_hostname.local.err
>
> 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
Curious... I don't see any such thing in my mysql error log. How did
you start mysql? Did you use the launchctl script using the
instructions printed once mysql5 +server is done installing?
> THE FILE "mysql-test-run.pl " DOES NOT EXIST, NEITHER DOES THE DIR
> "mysql-test"
> You can test the MySQL daemon with mysql-test-run.pl
> cd mysql-test ; perl mysql-test-run.pl
I'm not familiar with the test scripts. I do see that the portfile
explicitly deletes the mysql-test directory at the end. I don't know
why it does that. That directive has been there since the mysql5
port's inception in April 2005. But I don't think you need the tests
either.
> 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
mailing list