Hi,
I had the same problem and I solved it by running the MySQL server before your run php page. In Windows, you should change into the home directory of MySQL. Form there, enter:
c:\mysql>bin\mysqld [enter]
to check whether the MySQL server is running, you press the conbination keys of alt+ctrl+del. A box will display. If you can locate a process name mysql in the box. then the MySQL server is running.
There is other way to check whether the MySQL Server is running or not. you can write a short code as below:
<?php
phpinfo();
?>
run the code, if you see something about mysql in the page, then everythign is set.
Viet