• Home
  • Blog
  • Donate
  • WordPress Plugins
  • EMail Contact
  • Support Forum

Subscribe to
Stuff @ Yellow Swordfish

Recent Forum Posts

Latest Forum Posts

interior design and lifestyle review forum
julian in Show Us Your Stuff
on 8 Nov 2008 - 11:22 pm
PMs not accessible
Yellow Swordfish in Simple:Press Forum Version 3.0 to 3.1.4
on 8 Nov 2008 - 2:57 pm
Wishlist -> Widget
palenholik in Next Version - Simple:Press Forum V4.0
on 8 Nov 2008 - 1:13 pm
Forum not showing up
Rico in Simple:Press Forum Version 3.0 to 3.1.4
on 8 Nov 2008 - 1:04 pm
Forums links wont work after upgrade
Mr Papa in Simple:Press Forum Version 3.0 to 3.1.4
on 8 Nov 2008 - 1:46 am
Email Sender Name
derixc in Show Us Your Stuff
on 7 Nov 2008 - 7:33 pm
How insert Youtube videos in post
Mr Papa in Simple:Press Forum Version 3.0 to 3.1.4
on 7 Nov 2008 - 7:21 pm
Problem with small template
palenholik in Simple:Press Forum Version 3.0 to 3.1.4
on 7 Nov 2008 - 2:05 pm

On these pages are my WordPress plugins, the odd article and my Support Forum.

For my random rantings on everything else please visit my blog at Yellow Swordfish

WP Plugins

  • Site Plugins
    • Simple:Press Forum
    • Enlarger
    • Paged Navigation
    • Sub-Page Links

  • Admin Plugins
    • Click Tags
    • Admin Drop Down Menus
    • Download Counter 'Lite'
    • Download Counter 'Advanced'
    • Page Category Plus
    • Post/Page Update Notification

Articles

  • Articles
    • WordPress Tips #1
    • Caring For Your Database
    • Creating Custom Page Templates
    • Installing WordPress On Your Apple Mac

If you find any of my plugins useful, please comsider a donation towards my running costs.

Thank you

The MySQL Database Engine
  • Installing WordPress On Your Apple Mac
  • The Apache Web Server
  • The PHP Processor
  • → The MySQL Database Engine
  • The Websites
  • Installing WordPress
  • Cloning The Database

The MySQL Database Engine

MySQL can be obtained in a variety of versions and before choosing which one to use it is worth considering a few factors and what it is you plan to do with it. This tutorial is focused on having a working WordPress system running locally. Any version from V4 onwards will cater for this. But if you plan to make a copy of your own public site and wish to transfer the data from the public server to your local Mac then I would strongly recommend using the same version as your current hosting service.

Version 4.1 of MySQL changed the way that user authentication is performed. This makes it difficult, for example, to use V4.1 source data and copy it to a V4.0 MySQL locally. The opposite is even more problematic. If your hosting service is using a V4.0 MySQL server then download a V4.0 version. If they are using V4.1 or V5 then I suggest you use the equivalent. This tutorial does not cover the password changes.

MySQL V4 is available for download at the following URL:

http://dev.mysql.com/downloads/mysql/4.1.html

If you prefer V5 or even V5.1, there is a link to that page on the sidebar of the MySQL webpage above.

Locate the version of MySQL that you require from the download list. At the time of writing there is not a specific offering for OSX 10.5 but I have found the OSX 10.4 package to give me no serious problems (the one caveat to that is discussed later). Select the ‘package format’ and the correct processor version. In most cases, the ‘Standard’ version is all you are going to need.

Download the package and double-click to mount it. You will find that there are three items. The MySQL package itself, a MySQL Preference Pane and a MySQL StartUpItem package.

The Preference Pane is the one item that does not work correctly with Leopard. However, it is worth installing as it does correctly inform you if the MySQL server is running or not. The StartUpItem package will ensure that MySQL is started with every boot of your Mac.

My advice is to install all three and sooner or later there is sure to be a Leopard compatible preference pane.

Once everything is installed we have to let PHP know how to connect to MySQL and a little work to perform in the Terminal.

Connecting PHP to MySQL

Out first task is to open the php ini file that controls all of the options and settings available for php. Once again this is a hidden file. We need to locate this file at:

(YourHardDisk)/private/etc/php.ini

If it does not exist there will a file named ‘php.ini.default’. make a copy of it as ‘php.ini’ and open the copy - which is now the master - up for editing in your plain text editor.

You have two lines to modify to inform PHP how to connect to MySQL. Find:

mysql.default_socket =

and change it to:

mysql.default_socket = /private/tmp/mysql.sock

and then find

mysqli.default_socket =

and change it to:

mysqli.default_socket = /private/tmp/mysql.sock

Save and close the php.ini file.

Our next task is to fire up MySQL and configure it for use. For this phase I must thank http://maczealots.com/tutorials/wordpress/ for their older tutorial. This is used below almost verbatim and is the one time where we have to use the Terminal.

Open a new terminal session (found in /Applications/Utilities/Terminal.app) and type the following commands to navigate, make some changes, and start the MySQL daemon. Note these commands must be entered exactly as they appear here:

cd /usr/local/mysql
sudo chown -R mysql data/
sudo echo
sudo ./bin/mysqld_safe &

Next, let’s launch MySQL and use the test database (called test) to make sure everything’s running correctly:

/usr/local/mysql/bin/mysql test

If everything’s running correctly, you should see output similar to this:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version 4.0.24-standard

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

Once you’ve verified that MySQL is running correctly, use the command quit to return to the console prompt.

Now that MySQL is running, we’ll change the root password of MySQL so that WordPress (and you) can access it later. Use this command (where yourpasswordhere is replaced by your chosen password):

/usr/local/mysql/bin/mysqladmin -u root password yourpasswordhere

remember that password - you’re going to need it quite soon.

The last thing we’ll have to do in MySQL is create a database for WordPress to store its data. If you plan on making a copy of your public database, then I would recommend using the exact same name (including case) of your current public WP database. if this is not the plan then use any name you wish using alpha characters and no spaces.

To accomplish this, we’ll enter MySQL, create the database, and allow WordPress to edit it, replacing ‘databasename’ with the name you have chosen..

/usr/local/mysql/bin/mysql -u root -p
CREATE DATABASE databasename;
quit

Repeat this for every database you wish to re-create.

By this time and all being well, we have Apache, PHP and MySQL all working and talking to each other. Time to reboot your Mac (which will start MySQL if you installed the StartUpItem package), grab a coffee and consider the options in the next section.

Next: The Websites

Yellow Swordfish is © 2005-2008 by Andy Staines. All rights reserved.
The work is licensed under a Creative Commons Attribution-ShareAlike 2.0 England & Wales License.
Yellow Swordfish uses Wordpress