Powered by Blogger.

Monday, March 14, 2011

Drupal:Can’t connect to local MySQL

You can fix Drupal when you get an error “Can’t connect to local MySQL server through socket” by doing one of the following one at a time or a combination of them:

1 . If you are using the MySQL driver then try:
Open your sites/default/settings.php (or sites/YOUR_SITE/settings.php) and add a line like this:
ini_set(‘mysql.default_socket’, ‘/var/run/mysql/mysql.sock’);

Or if you are using the MySQLi driver then try:
Open your sites/default/settings.php (or sites/YOUR_SITE/settings.php) and add a line like this:
ini_set(‘mysqli.default_socket’, ‘/var/run/mysql/mysql.sock’);

2. Change your database server in your settings.php file from localhost to 127.0.0.1

0 comments

Post a Comment