Written by nitinpai on June 9th, 2008
3 Easy Steps to Install MySQL on Windows XP
Tutorials, Windows
63 responses
This article needed to be written from a long time and since it was not, I almost suffered the same hiccups during the installing of MySQL on Windows XP. Every single time I had to search the internet for the solutions which I often forgot over a period of time.

So today without any procrastination, I intend to put down the simplest of the steps to configure and run MySQL on Windows XP in the quickest of the time. First and foremost, as I always tend to follow a course is, break down the task into 3 steps. They are:
Step 1: Getting the software
Download the latest version of MySQL from the community site. Unpack it into your desired folder. It is always a good practice to download the zipped archive of MySQL binary distribution since using the one click installer, you might sometimes lose the power of configuration manually.
Its also a better way to understand configuring manually since if you switch to a Unix based environment later on, you will have to carry out a similar procedure and there is usually no one click installer in such environments.
I unpacked MySQL in C:\Program Files\mysql-5.0.45-win32
Step 2 : Configuring the environment
While configuring in the Windows environment you have to do two things. One, putting a file having a name my.ini in the Windows folder of the operating system. Two, setting the path in your system environment variable. Here’s what you have to do:
Creating Option File (my.ini)
Go to your installation path of MySQL (In my case it is: C:\Program Files\mysql-5.0.45-win32) and rename the file my-medium.ini to my.ini. Open the renamed file in notepad and add the following lines, just beneath the line which says, # The MySQL server and above the line port = 3306:
[mysqld]
# set basedir to your installation path
basedir=C:/Program Files/mysql-5.0.45-win32
# set datadir to the location of your data directory
datadir=D:/workspace/data
The second line as shown above is, configuring your database directory. This means, the path which you assign to datadir will be the path where your databases will be created. You have to make sure that the path exists before you assign it. There will a data directory in the MySQL installed path. If you provide a different path to the data directory than this default one, you must copy the entire contents of the data directory in that path.
Finally, drop the my.ini file into your Windows directory. In my case, I copied the file into the path C:/Windows
Setting the environment variable
After completing the above step, goto
My Computer > Properties > Advanced >Environment Variables > System variables > Path > Edit
In the Value box, goto the end of the line and put a semi colon and the path of the MySQL bin folder. In my case I have put it as:
;C:\Program Files\mysql-5.0.45-win32\bin
Click OK 3 times and thats it with the configuration of MySQL. You are all set to test the installation.
Step 3: Final Configurations and Running MySQL
You are actually good to go for running mysql. For this, open up your command prompt and type in the command mysqld –console. This will start the mysql database server. Whenever you run this command henceforth you will see these lines at the end:
[Note] mysqld: ready for connections.
Version: ’5.0.45-community-nt-log’ socket: ” port: 3306 MySQL Community Edit
ion (GPL)
When you see these lines, it means that mysql has started successfully. Its time to party!
Leave the command prompt open and start up another command prompt. For the first time you should do this:
C:\>mysql -u root -p
Enter password:
When it will ask for a password, just hit Enter. It will allow access to you without a password and will show up a prompt as:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.45-community-nt-log MySQL Community Edition (GPL)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
Note that your database has anonymous access. It is not a secure thing to let it like that. You should always access the database with a password. So for setting up the password you will have to do the below steps. Put in the commands which are highlighted as shown:
mysql> update user set password=PASSWORD(“admin”) where User=’root’;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3 Changed: 0 Warnings: 0mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> quit
Bye
Once you have done this, try logging into the server again without a password. It must show the below error:
C:\Documents and Settings\xpuser>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
This means, now your database is secure.You should be relieved that your mysql setup has got completed. Now every time you want to start in your database start the server in one command prompt and in the second command prompt login to the database server by doing:
C:\>mysql -u root -p
Enter password: admin
Thats it. Phew! I hope I remember the steps myself and now for my cup of cappuccino.

63 Responses
Wednesday, June 11, 2008
this article is very useful for installing mysql on windows xp.
do u have any idea how can i configure wordpress on my local computer.
Wednesday, June 11, 2008
@ajay – For configuring wordpress on your computer, you would need to install Apache server and also PHP for it. You would also have to configure PHP work with MySQL by putting in the required libraries.
Monday, June 16, 2008
you can download package from http://www.devside.net/ , which include WAMP(Windows, Apache, MySQL and PHP), if you only wish to install, you can select option as mysql. I’ve tried it once for windows purpose. Otherwise for me most of the linux flavors come with pre-installed, latest and stable version of mysql.
Monday, June 16, 2008
The servers also come in installer packages . There is one more good software called Vertrigo. Check it out http://vertrigo.sourceforge.net/ . But it is always better to learn the configuration by hand than automated. It helps in production environments at work.
Wednesday, June 25, 2008
How about using WampServer? I wanted better control so didnt go this way but could be convenient.
Wednesday, July 2, 2008
Thanks BUddy…..
DO Remember the steps to copy data dir to C:/workspace
Wednesday, July 2, 2008
@Arvind,
If you want to copy the data from datadir, you must need to stop mysql server. Otherwise, you would not get the proper data.
However, this is not good solution.
The better one is take your data backup using mysqldump utility. Infact you can also do backup using replication.
- Jignesh
Thursday, July 3, 2008
Hey.. Now i have Mysql running… Also, have jdk6 installed..
I have to connect the both.. Please Help me…. with JDBC Connection & DSN Settup.
Tuesday, July 15, 2008
Please help…
I’ve followed the instructions fine up to step three, but when I type mysqld -console in the command prompt, I just get command prompt not recognised – can’t figure out what I’ve done wrong though as I’m totally new the MySQL it could be anything.
Thanks in advance.
Adam.
Tuesday, July 15, 2008
Sorry, should clarify….I get the following…
‘mysqld’ is not recognized as an internal or external command,
operable program or batch file.
Wednesday, July 16, 2008
@Adam,
Please set the path to your MySQL bin directory in the system environment variables. Open up a new command prompt and then try. It will work
Sunday, August 10, 2008
[...] Read more … [...]
Tuesday, November 18, 2008
One more correction: The path set in the environment variables should be enclosed in quotes. For example,
;”C:\Program Files\mysql-5.0.45-win32\bin”
Monday, February 9, 2009
Wow! what an idea ! What a concept ! Beautiful .. Amazing ?
Monday, February 9, 2009
I don?t usually reply to posts but I will in this case. I?ve been experiencing this very same problem with a new WordPress installation of mine. I?ve spent weeks calibrating and getting it ready when all of a sudden? I cannot delete any content. It?s a workaround that, although isn?t perfect, does the trick so thanks! I really hope this problem gets solved properly asap.
Tuesday, February 10, 2009
@Samudra – I could not make out whether your problem got resolved or not. Could you resolve it by the method mentioned in the article?
Saturday, February 14, 2009
Can you write a similar article for the configuration of PHP , Apache and MySQL on a local Windows based computer .
Tuesday, February 17, 2009
It worked very well for me. I just noticed only once error when assigning a password to the user ‘root’. It didn’t recognize the database. So I changed the query to include the DB name.
update user set password=PASSWORD(”admin”) where User=’root’;
Tuesday, February 17, 2009
I forgot to copy the modifed query
update mysql.user set password=PASSWORD(”admin”) where User=’root’;
Saturday, February 28, 2009
I must say that you provide genuine, quality information. Thanks for this!
BTW, dpn’t you think your blog needs a better wordpress template?
Monday, March 2, 2009
@Applebees – I am curious to know what is the thing that made you feel this template is not better.
Thursday, March 5, 2009
Guys,
I need to install MySQL (no-install package) on Windows in the user’s home directory. How can I configure that in my.ini file? The entries basedir and datadir do not take relative path and also cannot use environment variables like %USERHOME%, etc.
Please help!
Thnx
Rajesh
Friday, April 24, 2009
Thank you for your help!
Tuesday, May 26, 2009
You may need to select the ‘mysql’ database before setting the password…
mysql>use mysql
mysql> update user set password=PASSWORD(”admin”)…
Monday, June 15, 2009
I have followed your blog’s instructions and finally when I type the mysqld command at the prompt I get the following message
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
What would anyone suggest I do ? Thanks in advance !
Tuesday, June 16, 2009
Guys , anyone tried Wampserver ?? Its an all one package for running server side applications on windows machines .
Tuesday, June 16, 2009
hi guys new here…
just a line for everyone you can use XAMPP/EasyPHP/WAMP on windows to begin with i have used all three and currently prefer XAMPP for control and near linux like handling. Mercury mail and webalizwer help to so do try XAMPP
Wednesday, June 17, 2009
@techknowl – I have used VertrigoServer. Its too the one click installer for all WAMP applications. Haven’t yet used Wampserver
Monday, June 29, 2009
You made some good points there. I did a search on the topic and found most people will agree with your blog.
Saturday, July 4, 2009
Thoughtful post and well written. Please write more on this if you have time.
Sunday, August 30, 2009
Nice write up…usually I never reply to these thing but this time I will,Thanks for the great info.
Friday, September 11, 2009
Thank You! Just what needed
Monday, September 14, 2009
I got the same error as Nick:
I have followed your blog’s instructions and finally when I type the mysqld command at the prompt I get the following message
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
What would anyone suggest I do ? Thanks in advance !
Regards,
Tux
Sunday, October 4, 2009
Hi,
First time i was successfully connected to mysql on windows XP using command :
mysql –console
Now that i’m agai trying to connect, it gives me error as:
mysql: unknown option ‘–console’
Saturday, October 10, 2009
The program runs as a server providing multi-user access to a number of databases. This cannot be installed client-side. It must be installed by someone who has administrative rights on the server side…
Saturday, October 10, 2009
The newest version is usually the best one out. Go to active state.com and download the windows version. Follow the prompts when installing and you should be all set..
Saturday, October 10, 2009
You can also change providers. There are thousands of hosting companies out there that will gladly take your business and do use MySQL.
Saturday, October 31, 2009
Verry good and helpful article.
Sunday, November 8, 2009
a good article
ihave used mysql with win2000 i have now changed to win xp pro oem setup cant install mysql i get mysql needs IIS CANT INSTALL IIS no install disks and no i386 folder HELP!!!
REGARDS
LAWRIE NEAL
Sunday, November 22, 2009
Please give me steps to install “mysql-5.1.38-win32″ on windows xp
Wednesday, December 2, 2009
This has been really interesting, thanks for that. I love this blog theme too!
Thursday, December 24, 2009
Thanks for the details, got the database up and running in no time.
Monday, January 25, 2010
Error comes after run mysqld -console in command prompt.
Error :
mysqld: unknown option ‘-c’
Aborting
Saturday, February 27, 2010
In step 2 it tells that rename the file my-medium.ini to my.ini… but i cant rename that because that file (my.ini) is already exist in that..
Saturday, February 27, 2010
hlep me plz… how to install mysql
Saturday, February 27, 2010
Error comes after run mysqld -console in command prompt.
Error:windows can’t find the mysqld-console
Thursday, April 8, 2010
Personally I swear by ApacheFriend’s XAMPP. Its a heavy distrobution, but it has *EVERYTHING*. When I need to trim it down, that is so much easier than finding all the things you need, and then finding a compatible DLL for something you want to do.
Friday, April 9, 2010
Just made the necessary modifications and it worked well. THANK YOU! for a job well done!!
Tuesday, April 20, 2010
And if you need to know how to use PHP for saving images in Mysql
http://www.einfobuzz.com/2010/04/saving-images-in-mysql-with-php.html
Friday, April 23, 2010
Generally, you should install MySQL on Windows using an account that has administrator rights. Otherwise, you may encounter problems with certain operations such as editing the PATH environment variable or accessing the Service Control Manager.
Sunday, April 25, 2010
if you need apache, mysql and php on windows you may choose the great tool WAMP Server. Just google it and install it.
Tuesday, April 27, 2010
That is an easy one. Download XAMPP and install!
Tuesday, July 13, 2010
when i am trying to set the password as you hav directed for installing MySql 5.0 it is showing the following error..plz help me out what to do…
ERROR 1046:No database selected
Friday, December 10, 2010
MySQL is a relational database management system (RDBMS)which has more than 11 million installations. The program runs as a server providing multi-user access to a number of databases. This cannot be installed client-side. It must be installed by someone who has administrative rights on the server side.
Saturday, December 11, 2010
Great article. It seems installing mysql with the msi installer is easy. You don’t have to type commands etc while installing.
Wednesday, January 26, 2011
i am performing the steps
1)copy the folder of mysql
2) and paste in to the c:program files
3)then in this folder iam copy the path of bin folder
4) then my computer right click advance environmental
system variables ok ok iam got it only two times not three times
5) then iam open cmd & type mysqld
but it gives an error
it is not recogniszed as internal & external coomand
please help me solve this query
Tuesday, March 8, 2011
there is no my-medium.ini file … in 5.0.92, 5.1.56 or in the latest 5.5.9 … download all three archives, extracted … went to configure the my-medium.ini and none can be found … searched each folder and nothing … i assume this “how-to” pertains to the version mentioned, 5.0.45 … sooo, going to use the installer version.
Monday, May 30, 2011
Thanks a lot!! Thanks for sharing the steps! Was really very helpful!
Saturday, August 27, 2011
Helpful resource ! only thing is now we are moving with MySQL 5.5 with MSI windows Installer. Are all these steps still required
Tuesday, September 6, 2011
Hello, I have troubles, All the commands work but when I put into a .bat it doesn’t work!!! Any idea???
Thanks
Thursday, September 29, 2011
how to install and use mysql
Sunday, November 20, 2011
Yes, i use these three steps to install SQL in my friends PC and i done it quit easily by using these three steps.
Wednesday, December 21, 2011
I followed the steps and on step 3 When I enter ‘mysqld -console’ it pauses for sec and give me my usual prompt.
I did have the path wrong at first witch gave me an error. How ever I hear only silence.