Bug #1881 mysql_install_db script error line 166 & line 383. if/then || instead of -o
Submitted: 18 Nov 2003 21:19 Modified: 21 Nov 2003 11:41
Reporter: Michael Reekie Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:server 4.1.0-0 OS:Linux (linux 8)
Assigned to: CPU Architecture:Any

[18 Nov 2003 21:19] Michael Reekie
Description:
The error occurs when installing MySQL-server-4.1.0-0.i386.rpm as a new install.
It is in the script /usr/bin/mysql_install_db
I tracked it down to a script error and I believe that there is a workaround.
Both lines contain if statements where the OR operator is a "||" instead of the bourne shell '-o' 

I am *BRAND NEW* to mysql, so I *THINK* this is a valid workaround, but it needs to be verified by someone who knows the product:
The workaround is to 
1. stop the mysql server
2. mv /var/lib/mysql /var/lib/mysql.bak
3. make the corrections to the script
4. re-run the script
5. start the mysql server

I hope this is helpful
-Mike R.

How to repeat:

To repeat, run: rpm -ivh MySQL-server-4.1.0-0.i386.rpm 
on a system that did not have a priory mysql install

warning: MySQL-server-4.1.0-0.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing...                ########################################### [100%]
   1:MySQL-client           ########################################### [ 50%]
   2:MySQL-server           ########################################### [100%]
/usr/bin/mysql_install_db: line 166: 0: command not found
Installing privilege tables

/usr/bin/mysql_install_db: line 383: 0: command not found
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

Suggested fix:
line 166:
  if test "$in_rpm" -eq 0 -o "$windows" -eq 0

line 383:
  if test "$in_rpm" -eq 0 -o "$windows" -eq 0
[18 Nov 2003 22:03] Michael Reekie
I missed some critical things about the work around.
After running the corected script, you have to modify ownership and permissions.
all the files in: /var/lib/mysql/mysql
must have ownership: mysql:root and permissions: 600
the directory  /var/lib/mysql/mysql itself must have ownership: mysql:root and permissions 711
[21 Nov 2003 11:41] Dean Ellis
This script has changed in 4.1.1 and no longer has the issue.

Thank you.