Prerequisites:
-You set up (or at least have user access to) the database and know how to get the existing Wordpress database into a file.
-You know your way around a command line
-You know how to setup Apache and PHP, MySQL on your Mac. No installation necessary.
Step 1
How to fix MySQL in Snow Leopard
Basically, thus:
Fix mysql.sock location in php.ini
In /etc/php.ini, replace the three occurences of /var/mysql/mysql.sock by /tmp/mysql.sock
- pdo_mysql.default_socket=/tmp/mysql.sock
- mysql.default_socket = /tmp/mysql.sock
- mysqli.default_socket = /tmp/mysql.sock
Step 2
Quickly import a database into a local computer
When you want to import a large SQL query in phpMyAdmin, you can run into problems as the default upload size limit is restricted by whatever it is in the php.ini file – and often, you cannot change this or simply don’t want to. It tends to default to a measly 2MB.
However, there’s a feature that will allow you to FTP your SQL file to an upload directory of your choosing, and then instruct phpMyAdmin to run the query file. Here’s how you do it.
Open up your FTP program, and navigate to the phpmyadmin folder on your server. Inside that folder is a file called config.inc.php – open this up in your trusty text editor.
While you’re still in your FTP program – create a directory inside the phpmyadmin directory called upload:
Towards the bottom of the config file, you’ll notice a potential setting for $cfg['UploadDir']. Change it so that it reads the following:
Don’t forget to add the “./” before “upload” – this just tells the program to look in the existing directory (phpmyadmin) for a folder called “upload” – there’s no need to change file permissions or anything.
Save it, and then go back to your ftp program, and upload a sql file to that directory.
When you go to the Import tab in phpMyAdmin, you’ll now see a drop-down list of available files within your upload directory. Pick the one you want to run.
Step 3
Not sure which of the two worked; probably the last item.
Edit wp-config.php
It should be possible to fix the site URL using a new feature -
Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.
define(’WP_HOME’,'http://example.com’);
define(’WP_SITEURL’,'http://example.com’);
That should be it. If it worked, stop reading this page now.
Thanks filosofo for the fix, implemented in 2.2.
Quick fix method
If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
1. FTP to the site, and get a copy of the active theme’s functions.php file. You’re going to edit it in a simple text editor (like notepad) and upload it back to the site.
2. Add these two lines to the file, immediately after the initial “
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
Use your own URL instead of example.com, obviously.
3. Upload the file back to your site, in the same location. FileZilla offers a handy "edit file" function to do all of the above rapidly, if you can use that, do so.
4. Load the login or admin page a couple of times. The site should come back up.
5. Repeat the above steps, but remove those lines. IMPORTANT: Do NOT leave those lines in there. Remove them immediately after the site is up and running again.
If there is no functions.php file in the theme: Create a new text file called "functions.php". Edit it with notepad, and add this text to it, using your own URL instead of example.com:
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
Upload that to your theme directory, then proceed as stated above. Remove the file afterwards.
Step 4
Fix permissions issues to develop themes
Set file permissions
On Mac OS X (Leopard), the Apache HTTP Server runs under the user account, _www which belongs to the group _www. To allow WordPress to configure wp-config.php during installation, update files during upgrades, and update the .htaccess file for pretty permalinks, give the server write permission on the files.
One way to do this is to change the owner of the wordpress directory and its contents to _www. Keep the group as staff, a group to which your user account belongs and give write permissions to the group.
$ cd /Users/
$ sudo chown -R _www wordpress
$ sudo chmod -R g+w wordpress
This way, the WordPress directories have a permission level of 775 and files have a permission level of 664. No file nor directory is world-writeable.
For reference, the Apache configuration file, httpd.conf, contains entries for the User and Group which the server will run as. The default setting is www for both.
For reference, on Mac OS X (Leopard), the user account information is located in the file:
/private/var/db/dslocal/nodes/Default/users/_www.plist
This file shows that the _www and www name map to the same user account.
=====
Bonus 1: enable mod_rewrite if you use friendly URLs for posts and pages (e.g., “blog.com/dec/12″)
Here, under ‘Fixing Other Issues’.
In two places in the httpd.conf file. A third is for the CGI directory if you wish to fix that.
AllowOverride Not Enabled
Your server may not have the AllowOverride directive enabled. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem. When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files. Example of enabled AllowOverride directive in httpd.config:
Options FollowSymLinks
AllowOverride All
You may also have to enable the AllowOverride directive in your DocumentRoot:
# … other directives…
AllowOverride All
Bonus 2
Character encoding showing up strange? The fix is here.
1. Upgrading to WP2.2 caused funny characters to appear.
FIX: Commenting these two lines out in wp-config.php fixed it.
// define(’DB_CHARSET’, ‘utf8′);
// define(’DB_COLLATE’, ”);
2. WP2.2 links to single posts from archive pages (or blog home page or search page) fails because of the presence of double byte characters in posts.
FIX: In the admin pages, I went to Options/Permalinks and re-saved the page.
=====
That should get you going. Good luck.

