There are two ways you can install PHP and MySQL. You could individually download the web server, programming language, databases and other tools… or you can download a simple all-in-one package. For this tutorial, we’re going with the latter.
Two of the most popular packages are WAMP and XAMPP. For this tutorial, I’m going to use WAMP. If you decide on XAMPP, that is fine too. The end result is basically the same. You may eventually try both and see which you prefer.
Download Wamp
Follow these simple steps and you’ll be on your way.
1. In your web browser, go to: http://www.wampserver.com/en/
2. The latest version as of July 3, 2009 is WampServer 2.0h. This includes Apache 2.2.11 (web server), MySQL 5.1.33 (database), and PHP 5.2.9-2 (programming language). If you download a newer version, it should be very similar, so don’t worry.
3. Here is the direct link to the download page: http://www.wampserver.com/en/download.php.
I suggest downloading it to your Windows desktop.
4. After downloading, double click the icon to start the installer.

5. Follow their instructions. When it asks where to install WampServer2, you can leave it at the default directory (c:\wamp)

6. You may want to put an icon on your desktop for easy access to WampServer2.

7. When setup is complete, go ahead and launch WampServer2.

8. You will see an icon in the Windows taskbar by the clock. We now have Apache, PHP and MySQL installed on our machine. We also have other helpful tools like phpMyAdmin, which we will use much later on. Congrats!
Configure Wamp
Now that Wamp is installed, we need to set a password for our MySQL database.
1. Click on the WampServer2 icon, go to the MySQL menu and load the MySQL Console.

2. You should see a basic prompt asking you for a password. Currently, there is no password, so just hit the “Enter” key to continue.

3. We need to set a password for our username “root”. This is a common username for Unix administrators, so you’ll likely see it a lot as your programming knowledge grows. To get started, type in: “use mysql” and push Enter.

4. It will tell you the database was changed. Next we will use SQL commands to update the user password. Type in: UPDATE user and push Enter.

5. Now type in: SET Password=PASSWORD(‘YOUR-PASSWORD’) and push Enter.
Replace YOUR-PASSWORD with anything you want. This will be your MySQL password. Be sure to remember it!

6. Great work. Next type in: WHERE user=’root’; and push Enter. Don’t forget the semi-colon at the end.

So let’s take a step back and see what we did. First we loaded our database. Then we told SQL to update the USER table and set the new password to YOUR-PASSWORD for our username “root”. If this doesn’t make complete sense yet, that’s okay. It will make more sense when we discuss databases later on.
7. Now we need to tell MySQL to reload the priviledge information. So type in: FLUSH PRIVILEGES; and push Enter.

8. Excellent. Now you can type exit to quit the MySQL console. If you load the MySQL console again, you will need to type in your new password to login. This is a great first step in securing your database.
So we’ve got Wamp installed and MySQL is ready. Everything is looking good. Let’s move on to choosing a code editor.
PHP is something I’ve been wanting to learn for years now but never got around to it. This is very easy to follow along with and I’m already learning something. If the whole site is this simple all the way through, I think I’ll be learning PHP in no time.
Thanks for sharing your knowledge!
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.36-community-log MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> use mysql
Database changed
mysql> update user
-> set password=password
-> where user=’root’;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ‘where
user=’root” at line 3
mysql>
I obtain this. What to do now?
Thanks.
It looks like you didn’t set a password when you were updating your user. Try this:
SET Password=PASSWORD(‘type-your-password-here’)