Installing WordPress on your own Windows computer

Configuring MySQL & phpMyAdmin

Before we can install WordPress we need a small amount of MySQL configuration. The WAMP installation creates a default MySQL root account with no password, and we should change this.

The simplest method is to use a tool called phpMyAdmin. This is a PHP interface to MySQL, and is also installed by WAMP. You can run phpMyAdmin from the WAMP menu. Once your browser loads it will contain this screen:

phpMyAdmin

Note the warning at the bottom – this is because root has no password.

Let’s add a password by clicking on the ‘Privileges’ link. From the privileges screen we can add and delete users, as well change the privileges and passwords assigned to existing users. We want to edit the ‘root’ user, so click the ‘edit’ icon on the far right of the user root.

Privileges

There will be a lot of information on the edit privileges screen, but we are only interested in the Change Password section:

Change password

Enter an appropriate password, enable the circle next to ‘Password’, and then click ‘Go’.

Now that we’ve changed the root password, phpMyAdmin no longer has access to MySQL. If we try and do anything else we get an error:

phpMyAdmin error

This is just what we want. Now we need to update phpMyAdmin to use the new password. Edit the file config.inc.php located in phpMyAdmin directory of our localhost document root. If you used the defaults at installation this should be C:wampwwwphpmyadminconfig.inc.php

Scrolling down a page or two you should find this section:

  $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
  $cfg['Servers'][$i]['password'] = ''; // MySQL password

Enter your password between the quotes:

  $cfg['Servers'][$i]['user'] = 'root'; // MySQL user
  $cfg['Servers'][$i]['password'] = 'mypassword'; // MySQL password

Now when you return to phpMyAdmin both the warning and error will have disappeared.

332 comments

  1. Hi John
    I followed your tutorial (very good and easy to understand) but at the point where i was asked to edit the:

    “$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL user
    $cfg[‘Servers’][$i][‘password’] = ”; // MySQL password”

    in the config.inc.php file I hit a brick wall as the above text is not in the config file so I cannot add the password.
    I have tried uninstalling and re installing but I still get the same error (Http 403 forbidden) message when
    I try to log into the phpMyAdmin
    Any suggestions?

  2. Finally a good explanation about wordpress installation, I’ve found this tutorial already but this one is the most detailed…
    It will be great to explain how to switch this install as a server, and not only as a local site. It will be great if you could explain it…(Stuck to the RSS comment)

  3. When I tried to install wordpress by entering:”http://localhost/wordpress/wp-admin/install.php” into the url of the browser, I got the following respond:”Fatal error: Call to undefined function did_action() in C:\xampplite\htdocs\wordpress\wp-includes\functions.php on line 1345
    “What went wrong?

  4. Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

  5. I had to reformat my hard drive and, as a result, needed to reinstall WampServer and WordPress. Originally, I followed the tutorial and had three separate WordPress blogs running on my local machine.

    This time, I’ve installed WampServer 2.0. I’ve edited my hosts, httpd.conf file and created the phpinfo.php file (all with Notepad++). My host file includes:

    127.0.0.1 localhost
    127.0.0.1 local.dcblog.com

    and, to the end of my httpd.conf file, I added:

    NameVirtualHost 127.0.0.1

    DocumentRoot “C:/wamp/www”
    ServerName localhost

    DocumentRoot “G:/Root/www/dcblog.com”
    ServerName local.dcblog.com
    ErrorLog logs/dcblog_error.log

    When I try the “localhost” url, I get the WampServer homepage.

    However, when I try “local.dcblog.com” I get a 403 Forbidden. You don’t have permission to access /phpinfo.php on this server.

    The directory “G:/Root/www/dcblog” exists on my G drive. I’ve tried different variations including dropping the idea of using a different drive; going back and using the tutorial’s original Document root. Same problem.

    Any suggestions on how to correct this error? This is the same config I had before, but this time I just can’t seem to tweak the system to behave.

    1. As a followup to my previous question: I finally chucked wampserver 2.0 and used Revouninstaller to completely uninstall. I made sure everything was gone, including any subdirectories. I then reinstalled WAMP5 v. 1.7.4. Same problems and error messages as with wampserver. I’ve googled the problem and found it is not unusual and is probably related to how I have the directories configured within http.conf. However, no matter how I twiddle with it, I can’t find a solution. I want my wordpress files to reside on a drive other than ‘C’. I had it working once; now, I’m stumped. Thanks!

      1. o.k. I “solved” my problem by digging DEEP and finally found a backup of my original http.conf file. Replaced my new http.conf with the old one and: success. I’m still curious as to WHY the new install wouldn’t work. I’m convinced its operator error, but have not been able to dig it out.

  6. John — Thanks for a great tutorial. One question:

    Do I need to write .htaccess and mod_rewrite rules to redirect the external links to blog posts (that came in with my import of my online blog database) to the new locations within the imported version of my database?

    Sean

    1. Hi John — here’s a bit more info:

      – my blog index.php comes up fine at local.profitscapes.com . I see all the pics, text, etc as the online version.

      – every link to a blog post, category, etc., however, points to its online location (for example, http://profitscapes.com/2009/04/new-ways-for-attorneys-to-grow-billable-hours/ ) — NOT my local version. I checked my local database, and the data is there, but the wp_posts field holds links to the online locations.

      Thoughts?

      Thanks,
      Sean

      1. Hi John,

        I’ve figured out a few things — I tweaked my database siteurl and home settings so that now my blog posts, pics, etc. point to a local source, but when I click on any blog post, I get a 404 error.

        A sample broken link:

        http://local.profitscapes.com/2009/04/new-ways-for-attorneys-to-grow-billable-hours/

        My virtual host info is:

        # NameVirtualHost 127.0.0.1

        #
        # DocumentRoot “C:/xampp/htdocs”
        # ServerName localhost
        #

        #
        # DocumentRoot “C:/xampp/htdocs/BurnsGroup_Site/blog”
        # ServerName local.profitscapes.com
        #

        #
        # DocumentRoot “C:/xampp/htdocs/BurnsGroup_Site/consult”
        # ServerName local.consult.profitscapes.com
        #

        Any tips would be greatly appreciated,
        Sean

  7. Hi John,

    Thanks for the tutorial!

    I’m a bit stuck with the wordpress installation. I can get as far as the page that asks for Blog title and email. From another tutorial, I gather that i am supposed to see a “Successful installation” message with my login and password. However, my page stays stuck after i key in blog title and email.

    Any idea how to resolve this or what did I miss? Thanks in advance!

  8. This was an awesome tutorial. One of the most unambiguous I’ve come across. Everything worked first time.

    Thanks

  9. Hi John, Thanks for the great tutorial which I’ve used successfully on Windows XP. The instructions are very clearly explained and the accompanying images are so useful.

    However, I’ve just purchased a new Windows Vista computer and I’m stuck on page 3 of your tutorial – I can’t locate the “host” file in the Windows 32 system, drivers, etc folder – there isn’t such a folder. Plus there’s also a Windows 64 bit system folder.

    Any advice on how to finish installing WAMP on the Vista system would be greatly appreciated as I have several sites in development that I’d like to use the new computer for.

    Cheers, and thanks in advance for any help you can give ……..

    1. Oops – turns out all I needed to do was turn on the hidden files to find the etc folder and the host file. Thanks to the folks at sitepoint.com forum who pointed that out to me!

  10. Thank you, thank you, thank you! This is just what I was looking for. I’m a newbie to web design and PHP etc., but have been tasked with redoing my small library’s website. After deciding to use WordPress as the CMS, our tech guy wouldn’t allow me to install it on our local server until I “knew what to do.” Now I’ll do the install on my local computer until I get the hang of it. I’ll show him!! 🙂 Thanks again.

  11. I have a problem with phpMyAdmin. When I load it from the link on the WAMP homepage, it gives me the error “Cannot load mysqli extension. Please check your PHP configuration. – Documentation.” I checked the documentation and it says that the mysqli extension not being found means that php_mysql.dll can’t be found. I checked the php bin that came with WAMP and in /php/ext/ the file php_mysql.dll is there. I changed php.ini to have the following:

    ...
    ;extension_dir = "./"
    extension_dir = "./ext"
    ...
    ;extension=php_mysql.dll
    extension=php_mysql.dll
    ...

    Thats what another site said to do, and that didn’t work. I added the file libmySQL.dll to my system32 folder which another site said to do, and that didn’t work. Can anyone tell me how I can get mySQL to find php_mysql.dll?

  12. Hi John
    I followed your tutorial (very good and easy to understand) but at the point where i was asked to edit the:

    “$cfg[‘Servers’][$i][‘user’] = ‘root’; // MySQL user
    $cfg[‘Servers’][$i][‘password’] = ”; // MySQL password”

    in the config.inc.php file I hit a brick wall.
    the path to config.inc.php i have in the new wamp software is x:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php
    When i change the password in that file all i get is;
    Error
    MySQL said: Documentation
    #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
    when i try to connect to phpmyadmin

    i just cant get this to work please help?

  13. not sure why others are having a problem doing this. It was pretty clear how to install WordPress using WAMP from reading your post. I think I’m going to test this out, only this time, i’ll use Apache on Ubuntu 🙂

  14. Thank you so much 🙂

    I already had a local installation of wordpress on wamp but I needed to develop two more sites and was getting the ebejeebies at how that was going to happen without running into loads of problems. After a bit of searching and lots of – no hit but plenty of miss – I came across your instructions and it worked like a dream.

    I now have three installations of wordpress running from the same installation of wampserver 2.1e

    You are the dogs 😉

  15. Hi John,

    Looked at your instructions but not sure if your site is applicable to what I want to do. I want to know if I can download the WordPress installation to create my own website to a location like a flash drive and/or a Windows computer so I can take it with me and be able to work on my site from another computer other than my own laptop, which is a 2004 macbook.

    Thanks,

    John H

Leave a comment

Your email address will not be published. Required fields are marked *