Bug #11800 Problems with multiple versions (4.0, 4.1) with mysqld_safe
Submitted: 8 Jul 2005 0:01 Modified: 8 Jul 2005 18:00
Reporter: David Koopman Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:4.1.12 OS:Linux (RH Linux 2.4.18-18.8.0smp)
Assigned to: CPU Architecture:Any

[8 Jul 2005 0:01] David Koopman
Description:
I am running mysql-standard-4.0.20-pc-linux-i686 and mysql-standard-4.1.12-pc-linux-gnu-i686 on the same machine, installed binaries.
I had a heck of a time running both of these versions at once. And not for the typical reasons: port collision, sock file, etc... I have that all figured out, I should be able to run two versions of MySQL on the same machine. I am running 4.0 out of /usr/local/mysql and trying to run 4.1 out of /usr/local/mysql-4.1 and cannot get it working for the life of my, using the mysqld_safe script.

I keep getting this error when I would start MySQL 4.1:

050707 14:46:41 Fatal error: Can't open privilege tables: File '/usr/local/mysql-4.1/share/mysql/charsets/?.conf' not found (Errcode: 2)
050707 14:46:41 Aborting
050707 14:46:41 InnoDB: Starting shutdown...
050707 14:46:43 InnoDB: Shutdown completed
050707 14:46:43 /usr/local/mysql/bin/mysqld: Shutdown complete

Notice: /usr/local/mysql/bin/mysqld (that's not what my basedir is!, it's "/usr/local/mysql-4.1" 

I am starting my server with:
/usr/local/mysql-4.1/bin/mysqld_safe --defaults-file=/etc/my-4.1-1.cnf --max-connect-errors=10000 --user=mysql

and /etc/my-4.1-1.cnf is this:

[mysqld]
pid_file = /var/lib/mysql-4.1/1/mysql.pid
basedir=/usr/local/mysql-4.1
datadir = /var/lib/mysql-4.1/1/data
port    = 3406
socket    = /tmp/mysql-4.1-1.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 16M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
server-id = 1
innodb_data_home_dir = /var/lib/mysql-4.1/1/tables
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql-4.1/1/logs
innodb_log_arch_dir = /var/lib/mysql-4.1/1/logs
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50 

On the other hand, if I start my server like this (using mysqld instead of mysqld_safe), it works fine:

/usr/local/mysql-4.1/bin/mysqld --defaults-file=/etc/my-4.1-1.cnf --max-connect-errors=10000 --user=mysql > /var/lib/mysql-4.1/1/mysql-4.1-1.err 2>&1 &

How to repeat:
Install 4.0 at /usr/local/mysql and put the conf file at /etc/my.cnf

Install 4.1 /usr/local/mysql-4.1 and put the conf file at /etc/my-4.1.cnf

Put your datadir for 4.1 at /var/lib/mysql-4.1 and make sure it's in the /etc/my-4.1.cnf

Start 4.0 (should work fine)

Start 4.1 with:
/usr/local/mysql-4.1/bin/mysqld_safe --defaults-file=/etc/my-4.1.cnf --max-connect-errors=10000 --user=mysql

The 4.1 version will start, then bomb out with:
050707 14:46:41 Fatal error: Can't open privilege tables: File '/usr/local/mysql-4.1/share/mysql/charsets/?.conf' not found (Errcode: 2)
050707 14:46:41 Aborting
050707 14:46:41 InnoDB: Starting shutdown...
050707 14:46:43 InnoDB: Shutdown completed
050707 14:46:43 /usr/local/mysql/bin/mysqld: Shutdown complete

Suggested fix:
Make mysqld_safe pick up the basedir and datadir from the designated defaults-file and use it in all places.  Sorry, I have not looked at the mysqld_safe script, I cannot tell you what's wrong with it, but it sure looks like it doesn't work if you try to install your basedir somewhere that is not /usr/local/mysql
[8 Jul 2005 0:28] David Koopman
I've posted this problem on my website, if anyone wants to discuss it with me off the mysql website:  http://www.modphp.org/viewtopic.php?t=394
[8 Jul 2005 11:14] Geert Vanderkelen
Hi,

I'm starting sometimes 5 versions all at once using mysqld_safe, and 'never' had problems.
Similar setup as yours. There must be something missing, can't see it right away.

Instead of opening a thread on external forums, can you make one on ours?
  http://forums.mysql.com/list.php?11

If the outcome is a bug in mysqld_safe, then we can continue with the bug report :)

Thanks,

Geert
[8 Jul 2005 17:54] David Koopman
I think you are right, there was something missing.

I moved to a new machine that does not have MySQL on it at all, then did this:

cd /usr/local
tar -xzf src/mysql-standard-4.1.12-pc-linux-gnu-i686.tar.gz
ln -s mysql-standard-4.1.12-pc-linux-gnu-i686 mysql-41
cd mysql-41
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
scripts/mysql_install_db --user=mysql
chown -R root  .
chown -R mysql data
chgrp -R mysql .

echo '[mysqld]
basedir=/usr/local/mysql-41
datadir=/usr/local/mysql-41/data
port=3306
socket=/tmp/mysql-41.sock
skip-locking
key_buffer=16M
max_allowed_packet=16M
table_cache=64
sort_buffer_size=512K
net_buffer_length=8K
read_buffer_size=256K
read_rnd_buffer_size=512K
myisam_sort_buffer_size=8M
server-id = 1' > /etc/my-41.cnf
cd /

This command:
/usr/local/mysql-41/bin/mysqld_safe --defaults-file=/etc/my-41.cnf --user=mysql &

Produces:
/usr/local/mysql-41/bin/mysqld_safe: line 1: my_print_defaults: command not found
/usr/local/mysql-41/bin/mysqld_safe: line 1: my_print_defaults: command not found
The file /usr/local/mysql/bin/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/mysqld_safe.
See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more
information

[1]+  Exit 1                  /usr/local/mysql-41/bin/mysqld_safe --defaults-file=/etc/my-41.cnf --user=mysql

(Note: No error log was created.)

This command:
cd /usr/local/mysql-41
bin/mysqld_safe --defaults-file=/etc/my-41.cnf --user=mysql &

Produces:
Starting mysqld daemon with databases from /usr/local/mysql-41/data

So, it works fine, as long as you cd to the /usr/local/mysql-41/ directory first, then call bin/mysqld_safe.  Works for me!

I looked at my first machine to find out why it was so broken there and discovered this:

$ rpm -qa | grep -i mysql
MySQL-client-4.0.9-0
MySQL-devel-4.0.9-0
MySQL-Max-4.0.9-0
MySQL-shared-3.23.56-1.0.23
MySQL-4.0.9-0

Bunch of RPMs that I didn't know where there and are not in use.  So, I did a:
rpm -e MySQL-client-4.0.9-0 MySQL-devel-4.0.9-0 MySQL-Max-4.0.9-0 MySQL-shared-3.23.56-1.0.23 MySQL-4.0.9-0

Then I ran:
cd /usr/local/mysql-4.1
bin/mysqld_safe --defaults-file=/etc/my-4.1-1.cnf --max-connect-errors=10000 --user=mysql &

... and now it works fine!  So, the problem has something to do with the existence of one of those older RPMs.

Sorry for the mis-reported bug, but hopefully this will help someone else that runs into this.
[8 Jul 2005 18:00] Geert Vanderkelen
We're sorry, but the bug system is not the appropriate forum for 
asking help on using MySQL products. Your problem is not the result 
of a bug.

Support on using our products is available both free in our forums
at http://forums.mysql.com and for a reasonable fee direct from our
skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

Additional info:

Doh, yeah, true, missed that :)

Actually, it's documented:
http://dev.mysql.com/doc/mysql/en/unix-post-installation.html

Put it as reply on your forum on modphp.org, so people know ;)

Cheers,
Geert
[9 Jul 2005 4:15] David Koopman
I updated my site http://www.modphp.org/viewtopic.php?t=394 to include the link you provided, and I posted the nutshell of the issue here:  http://forums.mysql.com/read.php?11,33600,33600 in case anybody cares to discuss it further.