Unfortunately OS X doesn’t comes with MySQL installed. To create your lamp stack on OS X, first you need to get the MySql database from MySQL AB. Installation is straight forward. But don’t forget to install the Mysql.pref which adds a preferences pane to System preferences for starting and stopping the server.
After installation to test your configuration open up a terminal and type
/usr/local/mysql/bin/mysql -u root
If you get prompt like the following. You got your Mysql database running.
$ /usr/local/mysql/bin/mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.0.51b MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>