Sunday, September 23, 2012

MySql Server for MAC os X Lion - 10.07


Installation

Till the date of writing this article there is no GA release package available for mysql Server for MAC OS X Lion or 10.7. The only package available are of the developmental release. One good thing though is that 10.6 package for mysql works equally well on 10.7. Follow below steps to setup 10.6 on your MAC OS X Lion:

1.  Download the MAC Disk Image for 10.6 MySql Server. Download from official MySql site: http://dev.mysql.com/downloads/mysql/

2.  Mount the disk image and install MySql package by double clicking it. The steps are simple.. so just keep on following on screen instructions from the installer. 

3.  Add /usr/local/mysql/bin to your path by editing .profile file.

4.  You can start MySQL server by running “/usr/local/mysql/bin/mysqld_safe &” from terminal but Disk image you downloaded also consists of Startup Package & Preferences Pane which allows you to start/stop MySQL server from System Preferences and even Automatically Start MySQL Server at Startup.

What does the Installation Package do?
 

The Mac OS X PKG of MySQL installs itself into `/usr/local/mysql-VERSION'

Note: /usr/local/mysql is just a symlink to /usr/local/mysql-version... So whenever you upgrade the symlink will remain same but it will start pointing to the new version that you have installed. This also means that if you want to migrate your data to the new version that you have just installed you will have to copy it manually. 

In addition to this, it also calls the grant tables in the `mysql' database by executing `mysql_install_db'.

About MySQLStartupItem Package

This installation of this package ensures that mysql automatically starts during system startup. So install this package only if you require to start mysql automatically on system startup.

This startup item gets installed into `/Library/StartupItems/MySQLCOM'. Startup Item installation adds a variable `MYSQLCOM=-YES-' to the system configuration file
`/etc/hostconfig'. If you want to disable the automatic startup of MySQL, simply change this variable to `MYSQLCOM=-NO-'.

On Mac OS X Server, the default MySQL installation bundled with the operating system uses the variable `MYSQL' in the `/etc/hostconfig' file. The Sun Microsystems, Inc. "Startup Item" installer disables this variable by setting it to `MYSQL=-NO-'. This avoids boot time conflicts with the `MYSQLCOM' variable used by the Sun Microsystems, Inc. "Startup Item".

Starting Mysql from Command Line

If you have installed the Startup Item, use this command:
     shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

If you don't use the Startup Item, enter the following command sequence:
     shell> cd /usr/local/mysql
     shell> sudo ./bin/mysqld_safe

You should be able to connect to the MySQL server, for example, by running `/usr/local/mysql/bin/mysql'.

Adding Aliases for easy access

     alias mysql=/usr/local/mysql/bin/mysql
     alias mysqladmin=/usr/local/mysql/bin/mysqladmin

Above allows you to access mysql directly without having to remember the full paths. 

No comments:

Post a Comment