2

I just moved my site onto the server and put it under /drupal_test directory. I now have got an error in the browser, but there is no errors in the apache error log:

PDOException: SQLSTATE[HY000] [2005] Unknown MySQL server host 'http://www.mydomain.com' (1)
in lock_may_be_available() (line 167 of /var/www/drupal_test/includes/lock.inc).

I have searched around online, many suggests that this is a problem with settings.php, but I can't see any problem with my settings:

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'websitedb',
      'username' => 'websitedbusername',
      'password' => 'thepassword',
      'host' => 'http://www.mydomain.com',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

I tried to use the ip address as the host, I got an error like this:

PDOException: SQLSTATE[HY000] [2013] Lost connection to MySQL server at
'reading initial communication packet', system error: 111 in lock_may_be_available()
(line 167 of /var/www/drupal_test/includes/lock.inc).

Also, my current site www.mydomain.com works fine.

Any help will be very much appreciated! Thanks!

7
  • 2
    Database host should be mydomain.com not http://www.mydomain.com
    – user11153
    Commented Sep 30, 2013 at 11:38
  • What @user11153 says - MySQL does not use http protocol, it uses mysql protocol. And you don't need to tell that when system knows you are configuring mysql ant=yway ;)
    – Mołot
    Commented Sep 30, 2013 at 11:45
  • 2
    Hello again. Your last edit changed the meaning of your question, making it a chameleon question. Please consider a rollback and asking new question.
    – Mołot
    Commented Sep 30, 2013 at 12:05
  • If it's running on the same system then use localhost/127.0.0.1 as database host for efficiency & portability.
    – AgA
    Commented Sep 30, 2013 at 12:32
  • 2
    @the_summer_bee from the point of view of the real host server, he is local and you are remote ;)
    – Mołot
    Commented Sep 30, 2013 at 12:57

1 Answer 1

4

In the above database configuration the problem seems to be with the host, you need to enter the "database hostname", or try entering the static ip "xxx.xxx.xxx.xxx" of the database host.

Aslo check the credentials of your database if they are correct or not. Discussion about the same issue faced be other people is available at: https://drupal.org/node/1315592 .

7
  • Hi, thanks, but as I edited, then I got a new error regarding lost connection to MySQL... Commented Sep 30, 2013 at 11:44
  • Are the database credentials correct, this error seems to be because of database connection not getting established. Commented Sep 30, 2013 at 11:47
  • I'm pretty sure they are right, I checked this in the server as well. I used the accounts access the database through putty the command lines, all works fine.. Commented Sep 30, 2013 at 11:55
  • I also tried to set root as database user, still doesn't work Commented Sep 30, 2013 at 11:57
  • 1
    It means the problem is with the host name only, so please once confirm the "database hostname" Commented Sep 30, 2013 at 11:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.