Mike's face
Saturday, October 20th, 2018








Mysql HowTo 4.1

Tuesday January 18, 2005 23:09

Who doesn't have trouble installing MySql 4.something?  Strange that such a fine product is so hard to install and configure.

$ cd ~/tmp
$ wget http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz/from/http://mysql.mirrored.ca/
$ su -
$ cd /usr/local
$ tar xzf /home/mike/tmp/mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz
$ ln -s mysql-standard-4.1.9-pc-linux-gnu-i686 mysql
$ cd mysql
$ scripts/mysql_install_db --user=mysql
$ chown -R root .
$ chown -R mysql. data
$ mkdir tmp
$ chown -R mysql. tmp
(adjust /etc/passwd file to make /usr/local/mysql mysql's home directory, or else if the mysql user doesn't exist create it like so: useradd -d /usr/local/mysql mysql

Create or edit /etc/my.cnf so that it reads:

[mysqld]
socket=/usr/local/mysql/tmp/mysql.sock

[mysqladmin]
socket=/usr/local/mysql/tmp/mysql.sock

[mysql]
socket=/usr/local/mysql/tmp/mysql.sock

(*colorful note: please someone tell me if there is an easier way... and no, I'm not going to install in /var/lib/something)

Complete installation

$ su - mysql
$ bin/mysqld_safe --user=mysql &
$ exit
$ mysqladmin password pickapassword

(*another colorful note: the windoze pushers are probably laughing at this point using their installshield like install...)

$ install -m 750 support-files/mysql.server /etc/rc.d/init.d/mysql4
$ chkconfig --add mysql4

Now the fun part.  I concluded there is a bug in mysqld_safe and/or mysqld, where even though it's instructed to run as a different user, it demands to have access to /root/tmp.  It's supposed to have switched user, THEN determine that user's tmp directory.
The solution is to switch to user 'mysql' ourselves, and THEN start up  mysqld_safe.
In /etc/rc.d/init.d/mysql4 which we just installed, locate:

$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &

Change this to:
/bin/su - mysql -c "$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >/dev/null 2>&1 &"

(C) Copyright 2004-2007 Mike Pot