I have already installed LAMP in my Ubuntu 18.10 server. I have also downloaded Drupal 7 files. But after I navigate to in my browser. The error below occurs:

The website encountered an unexpected error. Please try again later. 

PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() (line 167 of /var/www/html/drupal-7.65/includes/lock.inc).

Below are the configuration settings I edited in my settings.php file :

$databases = array (
             'default' => array (
                          'default' => array (
                                       'database' => 'pizzago',
                                       'username' => 'root',
                                       'password' => '1234',
                                       'host' => '',
                                       'port' => '',
                                       'driver' => 'mysql',
                                       'prefix' => '',

Do I have to put something on the port? I have make sure that MySQL is running. Actually I have log in on it using:

 MySQL -u root -p

I have also created an empty database named pizzago. Where am I missing?


The password above is not true.


When I tried changing database host to localhost, since my database is just within the server. Another error occurs:

 PDOException: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in lock_may_be_available() (line 167 of /var/www/html/drupal-7.65/includes/lock.inc).
  • 2
    In the $databases array try using localhost as a value for the 'host' instead of the IP.
    – AjitS
    Mar 27, 2019 at 7:12
  • 1
    Just ensure "pizzago" database is already created in your local mysql server. And then try giving mysql port '3306' and host is 'localhost'.
    – user15837
    Mar 27, 2019 at 8:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.