# MySQL Instal Errors



## hembeck (Aug 21, 2002)

Hey all,
I'm trying to install the .pkg version of MySQL as found on Marc Liyanage's site, following the instructions that he laid out, but I'm hitting a snag at step 7, where I type in "sudo ./bin/safe_mysqld --user=mysql &" I get the following:

```
[localhost:/usr/local/mysql] fernando% Starting mysqld daemon with databases from /usr/local/mysql/data
020821 18:15:23  mysqld ended
```
And that's it...I wait and wait and wait to see if something happens, but nothing does.

The only clue I know to offer is this error that is reported following step 2, "sudo ./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
[B]ERROR: 1062  Duplicate entry 'localhost-root' for key 1
ERROR: 1062  Duplicate entry 'localhost-root' for key 1[/B]
020821 18:14:06  ./bin/mysqld: Shutdown Complete
```
I've removed the installation using Marc's removal script ad have also deleted the MySQL user. (I've done this 3 times already, always with the same results that I've noted above.)

Please, any help!! 
-Fernando


----------



## uoba (Aug 22, 2002)

Hmm, I'm no expert but it seems to me that it maybe something to do with the default user database that gets installed with MySQL (the database is called mysql and contains the data of allowable users within MySQL)... is seems to prepare the tables for this database but halt because of something to do with the root user @localhost... duplicate entry? At a guess, maybe the uninstall didn't completely eradicate all the previous data, so when the package tries to create the user information, it finds an unmoveable duplicate.

Again this is a guestimate, rather than an expert talking, but, you can try to see if that data exist by doing the following (non-harmful ):

In the terminal type:

cd /usr/local/
ls
 
Can you see a directory called mysql? If so, then do:

cd mysql
ls 

Now, can you see a directory called data? If so, then you can also cd into there and that is where you would find the mysql database data.

If this is the case, you could try deleting the data with:



sudo rm -r mysql 

... but again, I would wait for confirmation from someone other than me, to tell you if I am right or not (if I'm wrong then sorry to take up your time  )


----------



## hembeck (Aug 22, 2002)

Thanks just the same, uoba. At least you're giving me a lead. I've posted all throughout the known Mac OS X community, and no one has said peep. I don't know if it's because I'm an obvious newbie or this is a real queer problem.

Thanks again. I'll give your suggestion a try.

-Fernando


----------



## hembeck (Aug 22, 2002)

Uoba,

I gave it a shot and the mysql directory is gone, so the uninstall worked. I was hopeful with you're post. Now I'm back to being perplexed.  

I think I may try the compile the source for mysql, rather than using the pkg installer.

-Fernando


----------



## mntamago (Aug 25, 2002)

I do not know if this will be of any help, but ...

I was using the MySQL package from Marc Liyanage's site before I install OS X 10.2.  Everything was going along fine...until I install 10.2 yesterday.  

As I looked around to see what was up I notice that 10.2 had removed my MySQL user account from the "Accounts" in my System Settings panel (sorry if the names are incorrect here, but I am using a Japanese Mac and everything is in Japanese).  However, the MySQL user information was still in the "Netinfo Manager".  Only, the home and shell had been set to /dev/null.

This is not what they originally where, so I reset them ...
home  /Users/mysql
shell  /bin/tcsh

After doing this I downloaded Marc Liyanage's mysql-3.23.51-jaguar.pkg.tar.gz, and followed his instructions.

Everything seems to be back in working order now.   


....BTW....while this is not MySQL trouble, my TOMCAT set up also need fixing thanks to 10.2!


----------



## uoba (Aug 25, 2002)

Yep, same problem here at home on my iMac... thnx for the info mntamago


----------



## uoba (Aug 25, 2002)

Ah, the ironey of it all, I now have the same problem as you hembeck on my iMac at home... I'm having a look now (mntmago's suggestion doesn't help  for this problem)


----------



## uoba (Aug 25, 2002)

Okay, you need to check you .err files to see what your particular problem is, to do this type:

cd /usr/local/mysql/data/
 

Here you should see the error files (usually your localhost address suffixed with the .err. Then type:

pico errorfilename.err
 

... replacing the errorfilename with the fil ename of course 

What's yours say?


----------



## uoba (Aug 26, 2002)

My MySQL is seemingly up and running but I cannot connect with the 'mysql' command!


----------



## mntamago (Aug 26, 2002)

> _Originally posted by uoba _
> *My MySQL is seemingly up and running but I cannot connect with the 'mysql' command! *



Question...what do you mean by "seemingly"?

Did you do a ls -la /tmp , and check for the socket...if that is what it is called.

Did you try a ps aux | grep mysql to see if the process was running?

Also, mysql seems to be a stickler for access permissions, but when you tried to connect did you use the following format...?

mysql -D someDatabase_name -u someUser_name -p

Did you try to access from the user that owns mysql?

....can't think of anything else right of hand, so I hope the above helps.

m(_ _)m


----------



## uoba (Aug 26, 2002)

By seemingly working I mean:

[localhost:/usr/local/mysql] martin% ./bin/mysqladmin version
./bin/mysqladmin  Ver 8.23 Distrib 3.23.51, for apple-darwin6.0 on powerpc
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          3.23.51-entropy.ch
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 14 min 59 sec

Threads: 1  Questions: 1  Slow queries: 0  Opens: 5  Flush tables: 1  Open tables: 0 Queries per second avg: 0.001 

... shows as being up and running.

However when I try the mysql command or even mysql -u root -p or whatever I just get the message 'mysql: command not found'!

Anyway, here's the ps aux | grep mysql info:


root     399   0.0  0.1     1828    576  p1  S     7:34AM   0:00.04 sh ./bin/safe_mysqld
mysql    416   0.0  0.1    12028    956  p1  S     7:34AM   0:00.04 /usr/local/mysql/bin/m
user   539   0.0  0.0     1416    308 std  S+    9:03AM   0:00.01 grep mysql


----------



## uoba (Aug 26, 2002)

Dudddeeee!!!

Just did a:
 ./mysql 

which opened MySQL!!!

This only from the usr/local/mysql/bin directory... any other directory will deny permisson!


----------



## mntamago (Aug 26, 2002)

> _Originally posted by uoba _
> *Dudddeeee!!!
> 
> Just did a:
> ...



I am at work now, so I don't have my notes at hand.  Yet, if memory serves me correctly connecting to mysql without giving a DB to connect to means that you are so of "connected but not connected".

Did you get a mysql prompt .... ?
mysql > 

If you did, try a show databases and see what you get.  If it gives you a list, then use help to get a list of terms and choose the one (again I for get what it is) that will connect you to a DB.

EX.
mysql > \c myDB

...where \c tells to mysql to connect to myDB database.

m(_ _)m


----------



## uoba (Aug 26, 2002)

Cheers mntamago

I am pretty much adept at using mysql in the command line, pre to 10.2 the 'mysql' command (or rather mysql -u username -p' ) would take you into MySQL. However, 10.2 has seemingly stopped this (hence the above post).

My MySQL is working, as the standard mysql and test databases are in there. Perhaps it something to do with the tcsh file commands (no mysql entry?)


----------



## mntamago (Aug 26, 2002)

uoba

You stated something that got me wondering.

"My MySQL is working, as the standard mysql and test databases are in there. Perhaps it something to do with the tcsh file commands (no mysql entry?)"

What do you mean by no mysql entry?

One thing I found was that after 10.2 installation, my $PATH would no longer print out mysql or postgres and such other open source software that I have installed.

What I had to do was add then /usr/local/bin and /usr/local/sbin to /etc/csh.login:

setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
set autolist

After doing this, and reopening the terminal, "which mysql" etc returned to its normal self again - i.e. it again gives me the paths to my non-Apple installed open source software.


----------



## hembeck (Aug 26, 2002)

Hey all,

I guess I'm not the only one perplexed by mysql! On my orginal post, I was getting Error 1062, stating that localhost was being written twice to key 1, and because I seemingly (there's that word again) could not log on, I assumed that was crapping mysql out. I believe I may have been wrong.

Because It took a while to get this thread going, and posts to other OS X boards proved pointless (no responses) I went out and got a book. It seems that because I wasn't properly requesting to input a password, by inputting mysqld -u mysql -p, I wasn't able to log on. That, though, does not explain away the Error 1062, which I still feel will come back to haunt me. An error just can't be good.

I'll keep an eye on this thread, because there's some knowledge tranfering going on here.

-Fernando


----------



## anmeier (Aug 26, 2002)

To find out why the demon stopped, check your .err log which should be in the data folder. Sometimes that gives you a hint. I have noted that you have to play with the permissions (mysql or whatever user you have the process run). 

Personally, I also had some problems since I upgraded to Jaguar. My current mysqld is working and I can access the databases fine through a PHPAdmin interface. However, when I try to load mysql from the commandline, I get the following message:

dyld: ./mysql Undefined symbols:
./mysql undefined reference to _BC expected to be defined in /usr/lib/libSystem.B.dylib
./mysql undefined reference to _PC expected to be defined in /usr/lib/libSystem.B.dylib
./mysql undefined reference to _UP expected to be defined in /usr/lib/libSystem.B.dylib
Trace/BPT trap

To get things back in order, I tried to recompile my mysql source, which had worked before, but now I am getting the following error:

Making all in client

... Stuff deleted...

readline/libreadline.a ../libmysql/.libs/libmysqlclient.a -lz -lm -lz -lm
ld: Undefined symbols:
_tgoto
_tputs
_tgetent
_tgetflag
_tgetnum
_tgetstr
make[2]: *** [mysql] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2

So, if anyone smarter than me can help, let me know!

Andreas


----------



## flash (Aug 28, 2002)

New install of 10.2, re-installed mysql. Like others, I get this when trying to access from commandline:

dyld: ./bin/mysql Undefined symbols:
./bin/mysql undefined reference to _BC expected to be defined in /usr/lib/libSystem.B.dylib
./bin/mysql undefined reference to _PC expected to be defined in /usr/lib/libSystem.B.dylib
./bin/mysql undefined reference to _UP expected to be defined in /usr/lib/libSystem.B.dylib
Trace/BPT trap

The mysqld is running, but I can't cmdline it. Installed 'off the shelf' from Marc Liayanage's http://www.entropy.ch/software/macosx/mysql/

Has anybody found a fix for this?


----------



## anmeier (Aug 28, 2002)

I have successfully installed the binary distribution from http://www.entropy.ch. Works like a charm. 

Would still like to know why Jaguar breaks both the old compiled mysql and does not allow a source compile (at least not with 3.23.52). Perhaps someone can enlighten us.

Andreas


----------



## hembeck (Aug 29, 2002)

> _Originally posted by flash _
> *New install of 10.2, re-installed mysql. Like others, I get this when trying to access from commandline:
> 
> dyld: ./bin/mysql Undefined symbols:
> ...



Marc has installation instructions for 10.2 & 10.X. Did you use the instructions for 10.2? It can be easily missed.   

-fernando


----------



## flash (Aug 29, 2002)

In fact, I did install MySQL onto Jaguar using Marc's instructions.   MySQL works fine... just not from the command line. 

I've been doing searches (google and this site), and this BPT/trap thing is apparently showing up with some other OSS installations. Apple moved around some libraries, or changed them, breaking many dependencies.

I had a somewhat similar problem with Marc's standalone PHP 4.1.1 install... but he said he didn't have time right now to update it for 10.2. 

Once I get past a hard programming deadline, I'll probably come back and try reinstalling MySQL again. Hopefully in the next few days there will be some corrective patching from Apple, and some fixes from the OSS people.


----------



## mntamago (Aug 30, 2002)

Let's see... I have gotten a little out of touch with this thread post, so perhaps this bit of info is not of much use, but ...

For those of you having trouble with binary versions of MySQL and are debating going about doing a source compile/installation, you might take a quick peek at the following Apple page:

http://discussions.info.apple.com/WebX?14@12.lHjza6aaclQ.6@.3bb95ecb/0

Apparently,the Configure file of v4.0.x of MySQL needs to be edited before one can get MySQL to install on Jaguar.

m(_ _)m


----------



## uoba (Sep 7, 2002)

hey mntamago,

been a while since you posted your csh.login hint, but I just got round to doing it at last, and it works a treat...

Big big thank you


----------



## uoba (Sep 7, 2002)

Now I'm getting the same problems as everyone else (now on my G4... clean installation):

dyld: ./mysql Undefined symbols:
./mysql undefined reference to _BC expected to be defined in /usr/lib/libSystem.B.dylib
./mysql undefined reference to _PC expected to be defined in /usr/lib/libSystem.B.dylib
./mysql undefined reference to _UP expected to be defined in /usr/lib/libSystem.B.dylib
Trace/BPT trap
 

Anyone?


----------



## mntamago (Sep 9, 2002)

uoba,

Sorry, I been here and there on the net searching for info concerning my Tomcat problem...not to mention coming down with a 39 Celsius temperature...so I have gotten a bit out of touch.

Glad to hear the csh.login hint helped.

In regards to your....


> *
> dyld: ./mysql Undefined symbols:
> ./mysql undefined reference to _BC expected to be defined in /usr/lib/libSystem.B.dylib
> ./mysql undefined reference to _PC expected to be defined in /usr/lib/libSystem.B.dylib
> ...



...I get this feeling that this is bigger than just mysql!!!  

Why? Well at a different posting site ...
http://forums.macnn.com/showthread.php?s=&threadid=121410

...I posted and was trying to get info about tomcat.  One of the questions that came back was "could I run other Java software?".  I had not thought to trying that, so I promptly went about trying to run some of my Java based appli - one simple HELLO WORLD type program, and one entrying data into postgresql through it Java interface.  Well, to my surprise, both programs coughed up the same type of error.  Namely, something dealing with dyld:

dyld: java multiple definitions of symbol _JNI_OnLoad
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libjava.jnilib(java.o) definition of _JNI_OnLoad
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libnet.jnilib(net.o) definition of _JNI_OnLoad
Trace/BPT trap

So, I am seeing again and again, problems here and there all relating back to this dyld.

What were you doing,or trying to do. with mysql when you got the dyld error?


----------



## uoba (Sep 9, 2002)

Thankfully I have refrained from installing Jaguar on our Server! This problem is on the clean install of my G4.

Anyways, I think my problem is the same as others, can connect to MySQL with phpMyAdmin, but not from the command line (which is where I would rather connect from)


----------



## mntamago (Sep 9, 2002)

I do not use phpMyAdmin, so I no nothing about it basically.  Yet, is it possible that phpMyAdmin uses a different user/permission to access mysql from that the terminal is using.

What I am suggesting here goes more like this.  When I access mysql thought my browser/cgi type set up, the user using the DB is nobody (or WWW, I forget which).  I have had to set up an account for this.  When I go throught the terminal, I use root.

Is it possible that phpMyAdmin users a different user?


----------



## uoba (Sep 9, 2002)

no phpMyAdmin uses root (as specified by the configuration .php file you have to configure prior to installation).

It seems to be a command line access problem then, since php files from the web server also seem fine to connect.


----------



## flash (Sep 9, 2002)

The *trace /btp trap* garbage is related to commandline access. For me it's only ever manifested on the commandline, indeed, I can't even import:

./mysql DBNAME < /path/to/dumpfile

which really hurts. I use easysql.php (found on hotscripts.com) as a sort of drop-in database management script for each of my projects. PHP has no problem connecting with it. 

My question is this: _Has anybody who installed the developer CD had this problem  too, under jaguar?_ I'm hoping that perhaps the dev CD has more/better libraries or something.


----------



## mntamago (Sep 10, 2002)

flash,

I not really sure what you mean by "this problem too", but if you mean importing/inserting from the terminal, I seem to be having know problems eventhough I have installed the dev tools that come with 10.2.

The script I us to import is the following shell script.

#!/usr/bin/csh

mysql << EOF
load data infile "$1" into table log_access.access_m fields terminated by ' ';

I run this off the terminal by typing...

csh 99_DBinsert.csh /Users/DB/LOGS_MySQL/LOG/200109/20010921.log.txt

I guess that because I am connecting to the DB via csh, in the strict sense I am perhaps not doing this from the terminal.

BTW, atfer installing 10.2 and the dev tools that came with it I had to 1) go to Marc Liayanage's page and get his 10.2 version of mysql; 2) "reset" my mysql user account in the NetInfo Manager - Apple took it upon themselve to screw around with my mysql account without premission...I guess the mysql user  I created was done without their permission, eh!; 3) do a chown -R mysql:staff on all my previously owned mysql directories to get things back to normal; 4) rework my permission within mysql by doing inserts into the user, db, tables_priv of the mysql database - the normal grant all ( select, update, delete etc) on a_table to some_user did not work for me when I tried to set/reset permissions in mysql.

Things seem to be working fine now, as far as mysql is concerned.


----------



## flash (Sep 10, 2002)

*mntamago* -- thanks for the pointer about the shell script! I'll see if it works for my current problems with commandline mysql access.

I had to follow the exact same steps you did after upgrading to Jaguar (reinstall mysql, chown to mysql user, rebuild mysql user in netinfo, &etc.). I guess the problem manifests whether someone installs the developer CD or not.  Oh, well.


----------



## mntamago (Sep 10, 2002)

flash

By all appearances, my mysql is functioning normally.  But then again, I really have not yet started to "use" it in my workings.  Until the recent present, I have been a postgreSQL user, battling with psql on Mac.  However, I felt that postgreSQL did not offer the speed, and it also was harder to work into tomcat appli, so I was just in the process of transferring over when 10.2 came out.

10.2 wiped out my tomcat set up - not to mention mysql. I have not got mysql back, but have yet to get tomcat back.  Once I get tomcat back I will start to go deeper...and perhaps start to find more mysql problems.  But until then, perhaps my "all appears fine" does not carry the weight that those of you who are using mysql extensivly are experiencing.

Additionally, because I had basically a clean mysql DB -i.e. no tables and data I cared about loosing, I think I deleted the whole thing, went to Marc's page, got the new 10.2 package, and started all over again...that is if memory serves me correctly.

So, perhaps these differences account for something!?


----------



## uoba (Sep 13, 2002)

Damn, I'm still getting the error!

 

I have done the NetInfo MySQL user bit, changed the /usr/local/mysql with chown -R mysql:staff mysql... and still nothing!


----------



## mntamago (Sep 15, 2002)

> _Originally posted by uoba _
> *Damn, I'm still getting the error!
> 
> 
> ...



Okay. Let's get a bit radical here!

If memory serves me correctly, when one installs mysql by the packages that Marc Liyanage has posted on his pages, applications/utilities (or whatever) get installed into /usr/local/bin .  If you take a glance into this directory you should see various files that start with my* . BTW there are also files that belong to mysql, but do not start with my*. These are all installed by the package installer.  

I deleted all the above files in /usr/local/bin/ that I thought belonged to mysql.  BTW, when I was in doubt, I renamed the file and check to see if something similar had been installed after the new installation was completed.

Now, with the above deletions completed, I conducted installation as if I was completely new to mysql.  I even renamed the old mysql directory I had on my hard disk at that time - 

mv mysql old_mysql

So, with all this said and done, once you have the new package installed check /usr/local/bin/ for new items installed.  Play around with the new mysql for awhile.  If everything seem to be going along okay, then one can work at bringing the old back into the new.

The radical part (?) comes when one starts to move entire directories back and forth between mysql and old_mysql.  The specific directory I have in mind here is ./data.

Well, how's that?  Radical?  Perhaps not.

Oh yes, the Golden Rule then is  "not to delete, but rather rename".  One wants to be able to get back to the start line if everything goes heywire!


----------

