Category Archives: Uncategorized

Installing MySQL on Mac OS X 10.7 (Lion)

Installing MySQL

  1. Go to http://www.mysql.com/downloads/mysql/
  2. Download “Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive
  3. Open the downloaded .dmg file.
  4. Open “mysql-5.5.19-osx10.6-x86_64.pkg” (or a similarly named file) and follow the instructions to install MySQL.
  5. Open “MySQL.prefPane” to add an MySQL entry to System Preferences.

To start the MySQL server, open System Preferences and go to MySQL. There you can start and stop the MySQL server. You can also choose to automatically start the MySQL server on startup.

PHP and Database Connection Problems

If you use Mac OS X’s build-in Apache web server, enabled the PHP module and get database connection problems, you need to edit /private/etc/php.ini. If this file does not exist yet, create it by copying /private/etc/php.ini.default.

Open php.ini and change the line

pdo_mysql.default_socket=/var/mysql/mysql.sock
to
pdo_mysql.default_socket=/tmp/mysql.sock

and

mysql.default_socket = /var/mysql/mysql.sock
to
mysql.default_socket = /tmp/mysql.sock

After saving php.ini, restart Apache with sudo apachectl restart