Error Installing Drupal7

I am using Xampp in Ubuntu Natty Narwhal and was trying install Drupal7 and I noticed the following error.

Warning: PDO::__construct(): [2002] Invalid argument (trying to connect via unix://) in /opt/lampp/htdocs/drupal7dev/includes/database/database.inc on line 324

In the red box:
In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the Installation and upgrading handbook. If you are unsure what any of this means you should probably contact your hosting provider.

Failed to connect to your MySQL database server. MySQL reports the following message: SQLSTATE[HY000] [2002] Invalid argument.

* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct database hostname?
* Are you sure that the database server is running?

For more help, see the Installation and upgrading handbook. If you are unsure what these terms mean you should probably contact your hosting provider.

Solution is simple,

replace localhost with 127.0.0.1.and it should work for you.

Leave a Reply

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