It’s been vastly covered by everyone, Lion Server doesn’t come with MySQL. It was replaced by PostgreSQL. So what do all of the WordPress users out there do? Well, it’s still possible to get MySQL installed on to your 10.7 Server – here’s how…
Lets start by downloading the latest 64-bit .dmg from the MySQL site. At the time of writing this, the latest version was 5.5.16 for 10.6 (there is no version for 10.7 at the moment, but don’t worry: this works fine).
Install the MySQL package and follow the onscreen instructions.
To make things easier, we are also going to install the ‘MySQLStartupItem’ package and the ‘MySQL’ preference pane file.
After you have added the preference pane, you can click ‘Start MySQL Server’ and also confirm it’s set to automatically start, if that’s what you desire.
Now you need to choose how you want to manage your MySQL databases. We have covered using phpMyAdmin in the past, but for good measure – this time i’m going to use Sequel Pro (of course if you really want, you can use Terminal). Download and install to your Applications folder, and then link it in your Dock for easy access.
Open up Sequel Pro and fill in the connection details. By default, MySQL is accessible by the user ‘root’ with no password.
Whilst we are in, we can add our database we want to use for WordPress. In the top left, select ‘Choose Database…’ and ‘Add Database’
Give the Database a Name and set the Encoding as UTF-8 Unicode (utf8):
We now need to add a new user to use that Database we just created. In the top right, select the ‘Users’ icon. In the window that opens, click the ‘+’ in the bottom left. Give the user a Username and Password:
With the new user selected on the left, click the ‘Schema Privileges’ tab. Select your newly created database from the left (under ‘Schemas’) and select all of the ‘Available Privileges’ and move them in to the ‘Granted Privileges’ column. Click ‘Apply’
You can now close Sequel Pro.
Open up Server.app and select ‘Web’ from the left. Check ‘Enable PHP web applications’ and click the ‘+’ to add a new site. Name it what you wish and set the ‘Store Site Files In’ to location:
Select ‘Done’ and start the Web Service.
Download the latest version of WordPress and put the contents in to the folder mentioned above.
We now need to set the php.ini file to look in the right place for the MySQL Socket. Select the ‘Go’ menu and ‘Go to Folder…’
Look for the ‘php.ini’ file and open with your favourite text editor (mine is TextWrangler). Look for the line:
Change it from:
Save the file and close TextWrangler. Stop and Start the Web Service in Server.app to be on the safe side.
Now head to your web directory you placed your WordPress files in. Rename the file ‘wp-config-sample.php’ to ‘wp-config.php’ and open it in a text editor. Enter the details of the Database and User you created earlier.
Save the file and open Safari. Browse to:
And you should be presented with the WordPress setup.