Are there any MySQL installs that actually work?

David Rodger

Registered
Hello folks,
I have been trying to get MySQL running for weeks. Nothing has worked and I'd really appreciate some help.

Here are some sets of instructions that I've tried:
Welling and Thompson, PHP and MySQL Web Development
Building Apache, MySQL, and PHP on Mac OS X
Marc Liyanage's compiled versions - now at 3.23.46
Various posts on MacOSX Hints
and I think there was something on Stepwise.

None of these work on my system. The most common problem is that, even if I get the mysqld daemon running, I cannot connect via mysql.sock. I get an error message like:
error: 'Can't connect to local MySQL server through socket '/tmp/' (38)'
Check that mysqld is running and that the socket: '/tmp/' exists!
There _is_ a /tmp! I put it there!

On a couple of occasions, there was no mysql.sock. On those occasions where there is a mysql.sock, it is an empty file (0 bytes) and, sometimes, is written to the wrong location (not /tmp).

All of Marc Liyanage's packages that I have tried have broken Classic Startup, and some low-level stuff that Installer and Pacifist rely on. I described this problem in this thread.

For my latest attempt, I downloaded the 3.23.46 Darwin binary. It was "pre-configured" (which I didn't know at first). When I ran the configure command, it said:
NOTE: This is a MySQL binary distribution. It's ready to run, you don't
need to configure it!

To help you a bit, I am now going to create the needed MySQL databases
and start the MySQL server for you. If you run into any trouble, please
consult the MySQL manual, that you can find in the Docs directory.

Installing all prepared tables
./scripts/mysql_install_db: no such file or directory [292]
...and that was the end of that!

I have previously tried the source files, unpacked them, configured them, made them, installed them, etc. to no avail. I can't be many more specific about any of these attempts. I've tried this so many times (must be more than 20 times now) that I can't remember what went wrong when.

How on earth did any of you do this? I don't want to be a Unix guru. I just want to get this stuff working, so I can use it.

If I can't get this happening soon, I'm going to try Postgresql. Of course, there are far fewer hosting companies that offer Postgres, but it can't be possibly be any harder than this!

Thanks in anticipation,
David
 
David wrote: If I can't get this happening soon, I'm going to try Postgresql. Of course, there are far fewer hosting companies that offer Postgres

I highly recommend using PostgreSQL instead of MySQL. I've used both of them over the past 4 years for many different projects. Whenever I am able, I always choose PostgreSQL over MySQL. It has MANY features that MySQL 3 just doesn't offer (and many that MySQL 4 won't offer either), including:

  1. Sub-selects in the FROM clause
  2. Transactions
  3. UNIONs
  4. Foreign key referential integrity
  5. All SQL99 join types
  6. Triggers
  7. Views
  8. Inheritance
  9. Support for UNICODE
  10. Secure connections with SSH or SSL
    [/list=1]

    Also, it has just as much support in all of the scripting languages (I've used it with Perl, PHP, and Java).

    Plus, I got PostgreSQL up and running in Mac OS X very quickly.

    Cheers
    --Dan
 
I highly recommend using Fink to install MySQL (and PostgreSQL).

http://fink.sf.net/

All the things I usually install on Unix systems are already there in Fink, debugged and ready to go. Easy peasy.

Cheers,
Martin
 
Thanks to those who posted replies. I'll consider Postgres, but as a last resort, I'll try Fink.

Here's some more information. I migrated to OSX just so I could noodle around with Apache, PHP and MySQL. I had some problems with Apache and PHP but managed to sort them out and they did not break anything. Mine is standard install of OSX 10.1, except for all the languages (I kept English and Swedish only). The only things I have changed are the recent Security Update, the new Installer, and 10.1.1.

Previously I said that Marc Liyanage's precompiled packages broke Classic Startup and installers such as Installer and Pacifist. Well, when I posted last night, I had installed MySQL from the mysql-3.23.46-apple-darwin5.1-powerpc binary. MySQL didn't work (of course), but at least everything else was working.

I started up this morning. Classic Startup stalls as described in my previous postings and Installer and Pacifist quit unexpectedly after I enter my root password. This happened with 10.1 and 10.1.1 -- absolutely no difference.

If Fink doesn't work, I will be firmly convinced that any installation of MySQL, however it is performed, whether from source, binaries, or packages, will break these parts of my system.

Of course, any light that any OSX or Unix gurus here can shed on this perserve behaviour will be greatly appreciated.

Regards, David
 
Big sigh

As per Dougiamos' suggestion, I downloaded fink and used it to install MySQL.

Here's what happened:

(Reading database ... 3565 files and directories currently installed.)
Unpacking mysql (from .../mysql_3.23.42-1_darwin-powerpc.deb) ...
Setting up mysql (3.23.42-1) ...
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
ERROR: 1062 Duplicate entry 'localhost-root' for key 1
ERROR: 1062 Duplicate entry 'localhost-root' for key 1
011221 14:40:48 /sw/sbin/mysqld: Shutdown Complete


... snip ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/sw/bin/mysqladmin -u root -p password 'new-password'
/sw/bin/mysqladmin -u root -h localhost -p password 'new-password'
See the manual for more instructions.


[... snip ...]

[localhost:~] root# /sw/bin/mysqladmin -u root -p password
Enter password:
/sw/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/' (38)'
Check that mysqld is running and that the socket: '/tmp/' exists!


I don't know whether or not the problems are connected with the error messages above. By now I don't care. There is no solution to MySQL installation. Every single install option is useless. And I bet that, when I restart, Classic Startup and Installer will be broken again, necessitating my 25th re-install of OS X.

What did I do to deserve this?
 
As per Dougiamos' suggestion, I downloaded fink and used it to install MySQL.
...snip...
And I bet that, when I restart, Classic Startup and Installer will be broken again, necessitating my 25th re-install of OS X.

Yes, they did break. MySQL, be gone from my life forever.
 
Hey! This is what I do to work with MySQL, wich works fine in my system.
1) First of all, I need to start the mysql daemon. I use the following commands:
Code:
[B][localhost:~][/B] sudo chown -R mysql /usr/local/var/
[B][localhost:~][/B] sudo safe_mysqld --user=[I]mysql[/I] &

After that, i got the following answer:
Code:
[B][localhost:~][/B] Starting mysqld daemon with databases from /usr/local/var

2) To use the mysql client, simply type mysql and hit RETURN. That will connect the client to the localhost where your database server is running.

3) For additional connections parameters you can try:
Code:
[B][localhost:~][/B] mysql -h host -u user

I have downloaded MySQL from Marc Liyanage's home page and followed all his instructions. Everything works fine.
The only thing I couldn't yet do is to start MySQL daemond at sturtup. :confused:
 
Hey! This is what I do to work with MySQL, wich works fine in my system.
1) First of all, I need to start the mysql daemon. I use the following commands:
Code:
[B][localhost:~][/B] sudo chown -R mysql /usr/local/var/
[B][localhost:~][/B] sudo safe_mysqld --user=[I]mysql[/I] &

After that, i got the following answer:
Code:
[B][localhost:~][/B] Starting mysqld daemon with databases from /usr/local/var

2) To use the mysql client, simply type mysql and hit RETURN. That will connect the client to the localhost where your database server is running.

3) For additional connections parameters you can try:
Code:
[B][localhost:~][/B] mysql -h host -u user

I have downloaded MySQL from Marc Liyanage's home page and followed all his instructions. Everything works fine.
The only thing I couldn't yet do is to start MySQL daemond at sturtup. :confused:
 
It's most encouraging to know that pretty much all of you, including Changomarcelo (last contributor) can happily install MySQL. I'm almost prompted to try again. However, I have to say that PostgreSQL is much less trouble. I downloaded Marc Liyanage's package of that and it installed and worked first time! Not a single hitch!

I suppose the most perplexing issue is why any installation of MySQL, regardless of method (package, binary, or source) or location (/sw by Fink, or /usr/local/mysql by Marc's package) breaks Classic Startup and Installer. It would seem that no one else has experienced this ... ever!

Anyway, I'm going on holiday so I'll think about this next week.

To those who celebrate it, happy Christmas. Happy holidays to those who don't.

Regards, David
 
In your post "Big Sigh" I notice that you hadn't started the MySQL daemon before trying to use mysqladmin. The daemon (mysqld) has to be running before you can use mysql or mysqladmin. To start mysqld you need to execute the following commands as root:

cd /sw
./bin/safe_mysqld &


If you want to get mysqld to run at startup you use fink's daemonic command which creates the correct entry in StartupItems. I think the syntax works like this:

daemonic mysql enable

If /sw/bin isn't in your PATH when you start the Terminal then check the fink install instructions for guidance.
 
More MySQL woes:

Slur wrote:
I notice that you hadn't started the MySQL daemon before trying to use mysqladmin

It's possible that I hadn't that time, but I had pretty much every other time and in my most recent attempt. What follows is what happened when I decided to use Marc Liyanage's MySQL-3.23.45 package again. Sorry, folks, it's lengthy.

I installed the db:
root# ./scripts/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
ERROR: 1062 Duplicate entry 'localhost-root' for key 1
ERROR: 1062 Duplicate entry 'localhost-root' for key 1
020103 18:54:01 ./bin/mysqld: Shutdown Complete


Can anyone tell me what the ERROR: 1062s mean?

I started the mysql server:
root# chown -R mysql /usr/local/mysql/*
root# ./bin/safe_mysqld --user=mysql &
[1] 410
root# Starting mysqld daemon with databases from /usr/local/mysql/data
020103 18:55:00 mysqld ended


I hit return to get back to the command line and entered mysql:
[1] Done ./bin/safe_mysqld --user=mysql
root# mysql test
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/' (2)


There is no /tmp directory (since my last install) and, therefore, there is no mysql.sock.

I immediately created /tmp, thinking I could reinstall the package and it might place the mysql.sock file in the right place. However, Installer was broken. (Admittedly, this was not unexpected. It's happened 25 times before.)

I Force Quit Classic and tried to restart it. I got the grey screen hanging problem again. This has necessitated reinstalling my system for the 26th time.

I follow the advice in this thread suggesting that I could force a socket connection by typing "mysql --socket=/tmp/mysql.sock -p". Of course this didn't work because mysql.sock was not there:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/' (2)

With pico, I created a blank file in /tmp called mysql.sock. (Earlier readers may recall that, when I have had a mysql.sock, it had 0 bytes in it. I still don't think that can be right, but no one has commented on it so far.) This did not work either, but the number at the end is now different:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)

On-reinstalling 10.1, Security Update, the post-10.1 Installer, and 10.1.1 (in that order), I found that mysql.sock had been placed in /private/tmp. I used pico to edit the client and mysqld socket to this directory. The result was the same as the previous error:
root# mysql test
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/' (38)

In fact, I have created tmp several times and it just disappears (or is replaced by /tmp n where n=1,2,3,...

Today, I find that InternetConnect does not work and Classic Startup and Installer are broken again. So it is not just the installation of MySQL, but the very presence of MySQL that fucks my system.

(The moderator might object to that, but after 28 re-installs -- all because of MySQL -- I'm entitled to a good curse.)

Postgresql's postmaster sure seems to be a much reliable connection method than this flaky 0-byte file called mysql.sock.

For all your great suggestions (none of which have worked so far, but I do appreciate them), none of you has commented on MySQL breaking my system every single time regardless of my install method. Am I the only person the planet for whom installing MySQL is an absolute impossibility? Is there any Unix guru who can give me even a half a clue about what is going on? Do I need to ask Apple about this?

Despondent,
David
 
Hi David,

Sorry you're having so much trouble with mysql. I also had a lot of difficulty with mysql for a solid month when I was first trying to get it installed, so I've definitely been through some of these difficulties. If after everything you still have trouble I'm sure Mac Liyanage would help you out but Apple won't be of any assistance because it's just not something they support.

I'm going to take a little time to download Marc Liyanage's package and see if I can get it running. Whatever happens I'll let you know the steps I had to follow. At this point I'm hoping I'll have some of the same issues you're having just so I'll be able to tell you what can be done - if anything. You shouldn't have to wait to get mysql running any longer!

One thing I can tell you is don't mess with /tmp or /private/tmp. /tmp in Mac OS X is a symbolic link to /private/tmp and if you move or change it you'll break your system.
 
1. I opened the package installer in Pacifist to check out the contents. It seemed perfectly fine, as it only places items into /usr/local.

2. Following Marc's instructions I made sure I had a user named "mysql." I had already created this user (and group) when I installed MySQL through Fink so I didn't need to do anything except run NetInfo Manager to make sure it existed. If it hadn't existed I would have created it through the Users pane.

3. I opened safe_mysqld in an editor to see where it wants to put the mysql.sock file (/tmp/mysql.sock) and which user it wants to run under (mysql of course). Everything looks as it should.

4. I did steps 4, 5, and 6 from Marc's page, installing the new databases and setting the owner of the mysql files to 'mysql.'

5. Since I already have another copy of mysql installed and running I needed to make sure the new copy wouldn't conflict with the existing one. So I edited the safe_mysqld script so it would write its sock file as /tmp/mysql_test.sock. I then typed:

% sudo ./bin/safe_mysqld &

MySQL started and then immediately quit, just as it did for you, with this message:

Starting mysqld daemon with databases from /usr/local/mysql/data
020103 17:37:25 mysqld ended


7. To determine the cause of the error I looked at the error log generated by mysql:

% more data/*.err
020103 17:37:25 mysqld started
020103 17:37:25 Can't start server: Bind on TCP/IP port: Address already in use
020103 17:37:25 Do you already have another mysqld server running on port: 3306 ?
020103 17:37:25 Aborting
020103 17:37:25 /usr/local/mysql/bin/mysqld: Shutdown Complete
020103 17:37:25 mysqld ended


8. Oops! I forgot I can't bind both to the same port. I edited safe_mysqld once more to tell it to use a different port, in this case 3307. This time when I executed safe_mysqld there was no problem. The mysql_temp.sock file appeared in /tmp as it should and I now have two separate mysqld daemons running.


So what did I learn from this experience?

First, that it looks as if you may already have mysqld running, but you should certainly look at the mysql error log to see in more detail why it won't start up for you. Also use ps -aux | grep mysql to see if mysql is in fact running, which I sincerely doubt.

Second, that you probably should completely remove /usr/local/mysql-3.23.46 and start from scratch, rebooting before reinstalling.

Third, don't do any of this as root. Use sudo.

I have to run, but let me know if any of this helps!
 
Success at last!

Thank you, Slur, Dougiamas, Dan, Iolaire, and Changomarcelo for all your help.

I came across an article Do Not Reinstall After Using the Mac OS X Update 10.1.1.

Well, I erased my OSX partition and started from scratch. What I noticed immediately was that there was a symbolic link /tmp pointing to /private/tmp, as slur had suggested. Somehow, along the way, I had lost that and I suspect that that was causing me all sorts of bother, including my system breaks. OTOH, I was sure I had not done anything to lose it (but I would say that, wouldn't I?).

I have tested Classic Startup and Installer after every step in Marc Liyanage's package and they continue to work. Beautiful.

I feel a lot more confident about doing things after having re-compile PHP a couple of days ago. Of course, now I must do that again, but I shall try it along with Postgres, GD and other things.

Once again, many thanks,
David
 
Back
Top