Connect…

RSS Twitter Facebook
YouTube LinkedIn

WordPress How-To

How to install WordPress + PHP + mySQL to a local development server environment on Windows or Mac, in 3 minutes

This is so easy it will knock your socks off.  It took me 10 minutes, but that was because I wasn’t clear on mySQL security – it should take 3 minutes, so this article could save you 7 minutes.  I did it because I was doing a lot of development with short testing cycles and was tired of the server lag-time of my remote server.

Windows Instructions (Mac instructions below)

  1. Download and install WampServer (Windows / Apache / mySQL / PHP – all in one bundle for Windows!)
  2. Start WampServer.  In Windows, the icon will now appear in your taskbar: image
  3. Point your browser to http://localhost
  4. Click on “phpmyadmin” on the lower left
  5. Immediately enter a new database name on the first screen (let’s call it “wp2”) and then Create.
    image
    You are now done with mySQL – no need to create a mySQL user as you would on a regular hosting account, as you  will be using the root mySQL user
  6. Download and unzip latest WordPress.  Ignore the instructions – just listen-up here
  7. The install file unzips to a directory called wordpress.  Copy and paste this directory into your root web server directory, which is normally c:\wamp\www.  So you now have a directory at c:\wamp\www\wordpress
  8. Point your browser to http://localhost/wordpress and proceed through initial screens (it will ask you to create a wp-config.php file).
  9. Enter the database name you entered in Step (“wp2”) and Database user (“root”).  Leave everything else as is and click “Submit”.
    Mac users enter “root” for the password as well (Windows user leave the password blank)
    image
  10. Hit “Continue” until the end.  Make a note of your (auto-generated) password.

You are done.  You can now enter your WordPress dashboard (http://localhost/wordpress/wp-admin) and from there install themes or plugins directly from your dashboard, just as you would normally.

Mac Instructions

  1. Download and install MAMP (Mac / Apache / mySQL / PHP).
  2. After starting MAMP, by default it should automatically load the “MAMP Start Page”. If it doesn’t, click Open start page.
    image
    image
  3. Navigate to the phpMyAdmin tab and create a database for your local WordPress installation. In this example below the database is called “wp2”.  Click Create.
    image
  4. Download and unzip the latest WordPress. Put the decompressed folder wherever you want. I recommend putting it in “/Users/(your user name)/Sites/“  You’ll link to it in Step 6.
  5. Return to MAMP, go to Preferences and check Ports. Click Set to Default Apache and MySQL Ports (the default ports should be: 80 for Apache/HTTP, and 3306 for MySQL)
    image
  6. Go to the Apache tab and select the location of your Sites folder (see Step 4).  Click OK.
    For example: If you point Apache to the folder /Users/(yourusername)/Sites/, and inside that folder you put the unzipped wordpress folder, then you access it in your browser at http://localhost/wordpress.
    image
  7. Now point your browser and navigate to http://localhost/wordpress and then follow the Windows instructions above from  Step 9 to install WordPress.

(Mac instructions kind courtesy of Collin Burton)

Very cool – thanks to the good folks at WampServer and WordPress.org.

If you like this article, please comment.

If you enjoyed this article, did you know that you can access a ton of additional free content, including the eBook WordPress 101 Quick Start: Your first site in 2 hours, by joining this site?
Registration is free and takes 15 seconds.

Do you know you can have a private coaching call with Marc for as little as $30, and sometimes immediately? Consider the benefits of having an expert solve a problem in 5 minutes that might take you frustrating hours of time messing with stylesheets, WordPress options and PHP

42 comments to How to install WordPress + PHP + mySQL to a local development server environment on Windows or Mac, in 3 minutes

  • Vanessa

    Soooo sweeet!!! Thanks heaps. The easiest instructions I’ve found and I’m not even a developer. Have been fudging my way around for ages trying to install Wordpress and a local server. Wish I’d found this page sooner!

  • Richard McCormack

    Isn’t connecting as root a big security hazard? I would recommend making a new user.

  • Kasey

    The login is requiring cookies – how is this possible if I am truly in the intranet zone???

    • marc

      Kasey — the web server sets cookies so it remembers your session details. It doesn’t distinguish whether you are localhost or coming in through the web. You are running the same software (Apache web server) as the large hosting providers — just a bit simplified in terms of access and security.

  • Kc

    Very clear and very concise but I do think you should include something about editing the wp-config or wp-config-sample file. But thank you – I did find this very helpful. ~Kc

    • marc

      KC – Yes wordpress keeps its database config information in wp-config.php, however if you follow these instructions you don’t need to edit the file, the automatic installer creates the file. If you were moving your Wordpress installation to another host you would need to edit the file on your new hosting location and copy the database over with phpmyadmin

      • Kc

        Hi Marc, I must have missed something as when I tried to go to http://localhost/wordpress I got an error on the screen that it required but could not find the wp-config file. I did know how to handle do it so it wasn’t a big deal. I thought you missed something but apparently — I did! Let me just repeat — excellent tutorial! Kc

  • Kasey

    I was trying to “learn the hard way” by installing Wordpress on my PC and getting it set up and then hopefully uploading it to my hosting space at GoDaddy … I am learning the hard way that the database is rather unforgiving … and php has a STEEP learning curve if you’re really just a typist …

    I got everything installed successfully, but in the process of playing around with it, found that it was difficult to undo what I had done … and the installation that’s done on the hosting server (GoDaddy) is automatic … I couldn’t find a “start over” button on the local host, and had no clue how to reconcile a finished product with the remote host, so … I guess it’s back to FrontPage for me!

  • hi thanks, however just want to mention, i have to disable my norton anti-virus else can’t access the localhost at all.

  • Is there a way to publish to the web from my local machine? I like working from my local machine and would love to know a way to just publish to my internet site.

    Thanks.

    • marc

      Jonathan,
      you would need to backup your wordpress database in phpmyadmin, restore it on the host, and copy over all files via FTP. Alternatively, if you haven’t changed any theme files, just reinstall on the new host using automated host script, install all plugins and themes, and then restore the database from your host’s phpmyadmin. Checkout the article “moving wordpress” on wordpress.org.

  • Awesome tutorial, I forgot WAMP existed and was going to install Apache, MySQL and PHP manually on my laptop. Thank you for the great tutorial, I did manage to get everything up and running in 3 minutes (actually less) !!!

    My Reality Changes

  • [...] I did a quick Google search for development environments on Windows and found a few including one for PHP development, another for PHP,  a few for MS SharePoint, and one for Drupal.  None of there really [...]

  • This is a basic question more for the programmers. I have two systems running a MAC OS 10.4 and a PC WinXP, they both have a lot of free space to run as a Web site house. But which one should I use? they are connected via a Belkin switch to one monitor. Which operating system is better suited for the task? And how much space does the hosting software take up, etc, etc.?

  • holake

    wordpress 2.9.2 is not connect to the database “Error establishing a database connection”, unless you go to wp-config and make changing

    define(’DB_NAME’, ‘putyourdbnamehere’);

    define(’DB_USER’, ‘usernamehere’);

    define(’DB_PASSWORD’, ‘yourpasswordhere’);

    define(’DB_HOST’, ‘localhost’);

    define(’DB_CHARSET’, ‘utf8′);

    define(’DB_COLLATE’, ”);

    anybody know the best way than this?

  • Javier

    Hi! Great tutorial! I’m a mac user and i was wondering how to run multiple installs on localhost.. (to create several wordpress blogs at the same time)

    Thx!

    • marc

      Javier,
      to run multiple installations just create them in separate directories within your root web server directory, ie wordpress1, wordpress2, wordpress3, each a copy of the wordpress installation directory and each with their own database

  • Verity

    Hmmm not my day today- this is the third thing I can’t get to work. Got all the way through the steps and then tried to point my browser (I’m on a mac) and it says

    Not Found

    The requested URL /wordpress was not found on this server.

    Any ideas?

  • Okay, I’ll bookmark this article. But, what are differences with Xampp?

  • Step #1 should read:

    Stop IIS —>>My Computer Manage —Internet Information Services—>Stop

    Without this you will not be able to call up localhost and your three-minute install becomes an hour of Googling.

  • Sorry but all this article is considered old tech since the appearance of BITNAMI stacks.

  • I follow all steps, but keep getting the message:

    “Error establishing a database connection”

    I am doing something wrong, but what??

  • I followed the steps one by one, but keep getting an error message from Wordpress about not able to connect to the database. As I did exactly what is described above, my only suggestion is that I’m doing something wrong with Wampserver.
    When I start Apache, MySQL and PHP isn’t php running twice?
    I mean should I only start Apache and MySQL??

  • They say there are no stupid questions, how do I point my browser to localhost. Is it C:/ or where the wordpress folder is..
    Thanks.

  • Thank you so much!!!
    This a great post. I went the whole install process in less then 10 minutes. I can’t believe it.

    Keep going strong man.
    A happy reader.
    Estani

  • barbara

    Hi there
    Same thing with KC, when I go to http://localhost/wordpress I get an error. I’m a rookie with this stuff I don’t quite understand what I need to do. Any help would be appreciated. Thanks
    -Barbara

  • Thea

    I am so very glad I stumbled upon these instructions. Fabulous, fabulous, fabulous – just what I needed!

    Many thanks!
    Thea

  • Al

    Thanks for the tut. Leave the password area empty to create the database. Otherwise it will show you the “cannot connect to database…” I realized after trying a couple of times :-)

  • Dee

    Best instructions I’ve found so far. Easy, easy. Up and running in under 5 minutes. Thank you!

  • That’s a winner indeed!
    Initially I tried my luck with WebPI. It kept asking for additional files (DLLs and many others)from SP3 and original disc. After painstakingly supplying file after file I noticed I hadn’t gone anywhere after more than an hour.
    When I found your concise instruction I knew it was for me.
    Great job very well done. Thank you so much. I was up and running in a snap. What can I say? I’m very pleased.
    Thanks a lot!

    Joerg

  • [...] more: How to install WordPress + PHP + mySQL to a local development server environment on Windows or Mac, … Tags: simple-que, [...]

  • Lucy

    Hi,

    I have installed this onto my mac. Having a problem though. It says:
    One or more database tables are unavailable. The database may need to be repaired.

    To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file. Once this line is added to your config, reload this page.

    define(’WP_ALLOW_REPAIR’, true);

    Does anyone know how I do this?

    Thanks!

  • Ralph

    I’m running mac OS X 10.6 and I’m running into a problem when I change the MySQL Port to the default “3306″. Apache connects but mysql does not. I’ve left the Apache set to the default port and changed MySQL back to 8889. It’s really strange. I’ve also test the port using the ‘nc’ command from the terminal. It fails the first couple of attempts but it always succeeds in connecting. Any ideas on how to fix this?

  • icyixora

    hi guys..im still new in the field..having prob installing wp.i got this error message saying my phpmyadmin is using the lower version when it is not..hope u guys can help me a bit..thanks~

  • Lynda

    Hi thanks so much for the instructions. They worked great! Unforunately though, the new pages I am creating on my install are coming up with a http 404 error. Although I can view my home page. Any ideas where I might be going wrong? I would be grateful for any suggestions…Thanks!

  • Claire

    Thank you!
    One comment – after changing the ports (Mac step 5) and selecting the Sites folder (step 6) you must close the Start Page you have open and open a new one from the MAMP panel. Otherwise the address http://localhost/wordpress can’t be found properly — it’s looking on port 8888 instead of port 80. I think that’s the cause of the various error messages people have mentioned here.

  • This looked so easy that I figured even I could do it. I downloaded, installed (using Firefox) and everything looked fine. I click on the desktop icon, after the usual “Do You want to allow…” comes up an nothing happens. It just goes back to a normal screen. When I point to
    http://localhost I get just a plain white screen. I’m running Win7.
    Is it compatible?

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>