neutrofoton

Science, Technology and Life

Install MySQL on OS X 10.8 Mountain Lion

| Comments

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 :

  1. mysql-5.5.27-osx10.6-x86_64.pkg
  2. MySQLStartupItem.pkg
  3. 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
1
sudo /usr/local/mysql/support-files/mysql.server start
stop mysql
1
sudo /usr/local/mysql/support-files/mysql.server stop
get mysql version
1
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
1
2
cd ~
vi .bash_profile
path
1
export PATH="/usr/local/mysql/bin:$PATH"

Then reload the new PATH

1
source ~/.bash_profile
test get mysql version
1
mysql -v
set mysql password
1
2
cd ~
/usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'

Comments