Hi. Dick, I'm sending this to the mailing list, too, because it's long
and it might be useful to someone else.
This goes through step-by-step installing on FreeBSD, leaving out some
things perhaps, but it's pretty thorough. If you don't care about that
topic, then you won't be missing anything by pressing 'D' now.
At 21:38, 19990829, Dick Griffin wrote:
>OK, the files in rc.d are created on Aug 18, and the
>files in /usr/local/bin were creaed Aug 21.
>This may be part of the problem.
It might be, it might not. The scripts in /usr/local/etc/rc.d are run
when the machine boots up - they can be anything, but typically that
is where you'll put scripts that start service daemons (like a web
server, database server, etc.). They're all Bourne shell scripts, so
you can read them with any text viewer to see what they do. Look at
them and find the one that runs safe_mysqld. That will tell you for
sure which mysqld you're starting.
If none of those scripts starts mysqld, then look at /etc/rc.local to
see if there's something in there that's doing it.
>I do not have a /usr/local/var/mysql and a
>/usr/db/mysql, with essentially identical files in
Is that word "not" a mistake? I'm assuming you *do* have both a
/usr/local/var/mysql *and* a /usr/db/mysql, and they have very similar
In that case, this is almost certainly your problem. I'm guessing that
your friend installed MySQL into various directories, and you installed
it into /usr/local. I could be wrong. BUT it sounds like it could be
hard to sort out which is whose.
>When I run .../safe_mysqld then the message returned is:
>Starting mysqld deaemon with databases from /usr/local/var
>mysqld daemon ended.
MySQL is keeping a log of error messages somewhere. It's called
`hostname.err`, and it is in the DATA directory (for you, probably in
/usr/local/var/`hostname`.err). If you read that file, it might tell
you something useful.
It's bad news to have two installations of MySQL on your system, unless
you planned it. The reason is because of these kinds of confusions. So
I'd suggest you do something like this:
* Find the script that is starting MySQL at boot time, and find out
which installation of MySQL is being started.
* Delete that installation (it's the wrong one, the one that doesn't
connect using Unix sockets, the one that's giving you 2002 errors).
* Find the right installation, and change your startup script so that
it calls the correct one.
That might be too confusing - sometimes it's easier to do it this way:
* Find any reference to MySQL anywhere on the system and delete it.
* Install from scratch again.
Installing should be painless. I'm not sure why your original install
didn't go correctly. I use these commands, and they work every time:
$ tar zxf dist/mysql-VERSION.tar.gz
$ cd mysql-VERSION
$ egcc -v
Reading specs from /usr/local/lib/gcc-lib/i386-portbld-freebsd3.2/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
# I've installed the egcs port, from /usr/ports/lang/egcs-devel. I think
# that port is gone now (it's now gcc-2.95.1). So for CC and CXX, just
# use whichever cc you have. 126.96.36.199 should work, but I'd recommend you
# install the latest port: http://www.freebsd.org/ports/
# Also, the last three CXXFLAGS are important - they avoid bugs in the c++
# compiler related to threads + exceptions.
# The final note about this configure line is the --with-named-thread-libs
# option. This will tell MySQL where to find FreeBSD's native threads, so
# it doesn't have to use the MIT-threads package. This is important if you
# want to be able to connect to 'localhost' using Unix sockets (instead of
# having to specify the host in every connect, and only being able to use
# the slower TCP/IP sockets). Native threads are better for many reasons,
# so you want to use them if at all possible. FreeBSD has native threads
# since version 2.7. They got a lot of improvements since that version,
# though, so I'd recommend you get the latest FreeBSD release (3.2).
# I'm specifying an installation prefix of /usr/local/mysql. I like to
# keep the whole application in one place. Some people like to have the
# database files in /var, the user applications in /usr/local/bin, etc.
# You can put things wherever you want, just remember where you put them.
$ CC=egcc CXX=egcc CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe -felide-constructors
-fno-exceptions -fno-rtti" ./configure --with-named-thread-libs=-lc_r
[ ... output of configure here ... ]
[ ... output of make here ... ]
# You have to be 'root' to install things. I don't like to work as
# root, so I use the 'sudo' program (/usr/ports/security/sudo). If
# you don't want to install that, just su to 'root', and then leave
# out the word 'sudo' anywhere it appears in the following commands.
$ sudo make install
[ ... install here ... ]
# don't do this next command if you have an existing MySQL installation
# in the --prefix directory already
$ (cd scripts && sudo sh mysql_install_db)
[ ... output of mysql_install_db here -- make sure that it was successful! ]
# This sets up the script to start MySQL when your machine boots. The
# script has to be executable or FreeBSD won't start it up (see the code
# at the end of /etc/rc to see exactly what's happening).
$ sudo cp /usr/local/mysql/share/mysql/mysql.server /usr/local/etc/rc.d/mysql.sh
$ sudo chmod 755 /usr/local/etc/rc.d/mysql.sh
# Now run the startup script by hand. This should get your server started
# and ready to use.
$ sudo sh /usr/local/etc/rc.d/mysql.sh start
$ mysql -uroot mysql
[ ... ]
mysql> select version(), user();
If that works, then you're all set.