Bug #56280 Mac installer's postflight script does not work all the time
Submitted: 26 Aug 2010 5:44 Modified: 7 Dec 2016 20:27
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.1.50 OS:Mac OS X (10.5, 10.6)
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: Triaged: D2 (Serious)

[26 Aug 2010 5:44] Hakan Küçükyılmaz
Description:
The installation document for MySQL on Mac OS X says

The Mac OS X PKG of MySQL installs itself into
`/usr/local/mysql-VERSION' and also installs a symbolic link,
`/usr/local/mysql', that points to the new location. If a directory
named `/usr/local/mysql' exists, it is renamed to
`/usr/local/mysql.bak' first. Additionally, the installer creates the
grant tables in the `mysql' database by executing `mysql_install_db'.

mysql_install_db fails if there is a /etc/my.cnf on the system pointing
to a different DATA_DIR than /usr/local/mysql/data

How to repeat:
I used mysql-5.1.50-osx10.6-x86.dmg on my Mac OS X 10.6.

Make sure that you have a /etc/my.cnf with a DATA_DIR pointing
somewhere else than /usr/local/mysql/data

* Mount the image
* Double click mysql-5.1.50-osx10.6-x86_64.dmg
* Click through the installation
* Result: the installation finishes and states that it was successful

Check /usr/local/mysql/data/mysql and see that the system tables were not installed.

au0013:mysql hakan$ ls -las data/mysql
total 0
0 drwxr-x--- 2 _mysql wheel  68 Aug  4 21:48 .
0 drwxr-x--- 4 _mysql wheel 136 Aug  4 21:48 ..

Check /var/log for install.log
Aug 26 07:24:17 au0013 installd[84859]: PackageKit: Executing script "./postflight" in /Volumes/mysql-5.1.50-osx10.6-x86_64
/mysql-5.1.50-osx10.6-x86_64.pkg/Contents/Resources
Aug 26 07:24:17 au0013 installd[84859]: ./postflight: 100826  7:24:17 [Warning] '--skip-locking' is deprecated and will be 
removed in a future release. Please use '--skip-external-locking' instead.Aug 26 07:24:21 au0013 installd[84859]: ./postflight: ERROR: 1136  Column count doesn't match value count at row 1
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: 100826  7:24:22 [ERROR] Aborting
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: 100826  7:24:22 [Note] ./bin/mysqld: Shutdown complete
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: Installation of system tables failed!  Examine the logs in
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: /data/mysql for more information.
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: You can try to start the mysqld daemon with:
Aug 26 07:24:22 au0013 installd[84859]: ./postflight:     shell> ./bin/mysqld --skip-grant &
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: and use the command line tool ./bin/mysql
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: to connect to the mysql database and look at the grant tables:
Aug 26 07:24:22 au0013 installd[84859]: ./postflight:     shell> ./bin/mysql -u root mysql
Aug 26 07:24:22 au0013 installd[84859]: ./postflight:     mysql> show tables
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: Try 'mysqld --help' if you have problems with paths.  Using --log
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: gives you a log in /data/mysql that may be helpful.
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: Please consult the MySQL manual section
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: 'Problems running mysql_install_db', and the manual section that
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: describes problems on your OS.  Another information source are the
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: MySQL email archives available at http://lists.mysql.com/.
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: Please check all of the above before mailing us!  And remember, if
Aug 26 07:24:22 au0013 installd[84859]: ./postflight: you do mail us, you MUST use the ./bin/mysqlbug script!

Suggested fix:
The postflight script has an error.

if cd /usr/local/mysql ; then
	if [ ! -f data/mysql/db.frm ] ; then
		./scripts/mysql_install_db --rpm
	fi

	if [ -d data ] ; then
		chown -R mysql data
	fi
else
	exit $?
fi

./scripts/mysql_install_db --datadir=./data --rpm

fixes the issue
[27 Aug 2010 2:18] Hakan Küçükyılmaz
Fixed Synopsis Max -> Mac
[28 Aug 2010 9:56] Valeriy Kravchuk
Verified just as described also with .dmg for Mac OS X 10.5.x.
[7 Dec 2016 20:27] Yngve Svendsen
Posted by developer:
 
This relates to EOL (no longer supported) versions of MySQL Server. Furthermore, both Mac OS X and the MySQL packaging on OS X have gone a long way since this was reported. Thus closing.