Before install mysql, i'd like to introduce how to configure apache on mac os. It was preinstalled on mac osx.
1.1 basic info
sudo apachectl start/stop/restart
Check the version of Apache:
Server version: Apache/2.2.24 (Unix)
Server built: Sep 12 2013 16:12:49
Check http://localhost on browser, you can view "it works!".
Mac OSX has 2 historically web roots one at a system level and one at a user level. You can set both up or just run with one. The user one allows multiple accounts has their own root whilst; the system one is global for all users.
system level web root
user level web root
The directory is "~/Sites" which is missing by default. You need this by yourself.
Check that you have a "username.conf" filed under:
If you don't have this file, just create one named username.conf, vi/nano this file:
Options Indexes MultiViews
Allow from all
Permission should be 644, like
Then restart apache
sudo apachectl restart
If you are using the system level web root, it's a good idea to allow any .htaccess files used to override the default settings. Editing httpd.conf:
2.1 download: http://dev.mysql.com/downloads/mysql/
2.2 Install the .dmg
sudo /usr/local/mysql/support-files/mysql.server start
Add mysql directory to ".bash_profile", if you don't have this file, just create it.
add this line into .bash_proflie:
Then you can use mysql command directly.
2.4 Set admin password
/usr/local/mysql/bin/mysqladmin -u root password 'yourpasswordhere'
2.5 Fix the 2002 MySQL Socket error
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock