Nov 11, 2009

MYSQL setup on Mac OS X

How to download, install, setup and get running with MySQL
1> Download mysql from http://dev.mysql.com/downloads/ I got the mysql-5.1.40-osx10.5-x86.dmg
2> Create a user account mysql
Login: _mysql
Uid [#]: 74
Gid [# or name]: 74
Generated uid: FFFFEEEE-DDDD-CCCC-BBBB-AAAA0000004A
Home directory: /var/empty Shell: /usr/bin/false
Full Name: MySQL Server
Office Location:
Office Phone:
Home Phone:

3> After loading the image, run the mysql-5.1.40-osx10.5-x86.pkg. It will ask some basic questions as to which location to install and then install the package in /usr/local/mysql
4> ls -l /usr/local/mysql
lrwxr-xr-x 1 root wheel 24 Nov 8 23:28 /usr/local/mysql -> mysql-5.1.40-osx10.5-x86
5> After installation, we can start MySQL with an admin privilege user account from the terminal window like this...
shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe (enter password, if needed) (press CtrlZ)
shell> bg (press CtrlD to exit the shell)

6> You should be able to connect to the MySQL server by running /usr/local/mysql/bin/mysql
7> ps -eaf | grep mysql
0 8120 7874 0 0:00.04 ttys002 0:00.06 /bin/sh ./bin/mysqld_safe
74 8163 8120 0 0:09.74 ttys002 1:25.97 /usr/local/mysql-5.1.40-osx10.5-x86/bin/mysqld
--basedir=/usr/local/mysql-5.1.40-osx10.5-x86
--datadir=/usr/local/mysql-5.1.40-osx10.5-x86/data
--user=mysql --log-error=/usr/local/mysql-5.1.40-osx10.5-x86/data/{computername}.local.err
--pid-file=/usr/local/mysql-5.1.40-osx10.5-x86/data/{computername}.local.pid

8> Additionally download the MySQL GUI Tools and MySQL Connector/J 5.1 from MySQL page. The former is helpful in creating user accounts and schemas.



9> When creating the schema, select the Catalogs icon, select the def menu and click on the add button on the bottom left.
10> When creating user accounts add the %, localhost and any other specific IPs that the user can connect from. The documentation says % means all IPs, however that did not work for me. The add subtract buttons are at the bottom left.
11> Then change the tab to Schema privileges and select the relevant schema (created above) and relevant privileges (I select all). This has to be done for each individual host (%, localhost and specific IPs of the new user).
12> The resources tab can be left at all unlimited.

Additional start/stop commands
sudo /usr/local/mysql/support-files/mysql.server start 
sudo /usr/local/mysql/support-files/mysql.server stop
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
 
You now have a running mysql instance, a schema of your own and a user associated to do all the operations with that schema as well.

Whatsapp Button works on Mobile Device only

Start typing and press Enter to search