This is also easy to do on MacOS X. Go to MySQL and download the latest version of MySQL for the Mac used. Then install it from the package. The instructions here are better than anything that could be written here.
Add the MySQL binaries to the profile:
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
To secure the server, run the script below:
To back up a database:
mysqldump -u root -p database_name > database_name.sql
To restore a database:
mysql database_name -u root -p < database_name.sql