To install mysql the first thing that we need to do is download mysql installer on the mysql website. In that web site we can see several versions of mysql. We will use Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive. When we open the mysql-5.5.27-osx10.6-x86_64.dmg
file, we will find 3 package installers.
Install all the three packages with the following order :
- mysql-5.5.27-osx10.6-x86_64.pkg
- MySQLStartupItem.pkg
- MySQL.prefPane
To start/stop MySQL we can use GUI tool from System Preferences > MySQL
We can also start/stop MySQL via terminal
# start mysql
sudo /usr/local/mysql/support-files/mysql.server start
# stop mysql
sudo /usr/local/mysql/support-files/mysql.server stop
# get mysql version
sudo /usr/local/mysql/bin/mysql -v
In order to use MySQL command without have to specify MySQL installation full path, we need to add MySQL installation directory to shell path.
# bash profile
cd ~
vi .bash_profile
export PATH="/usr/local/mysql/bin:$PATH"
Then reload the new PATH
source ~/.bash_profile
# test get mysql version
mysql -v
# set mysql password
cd ~
/usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'