Results 1 to 9 of 9

Thread: Error message / Could not connect to database

  1. #1
    User
    Join Date
    06-19-09.
    Posts
    106

    Default Error message / Could not connect to database

    This morning, a Typolight website shows the below error message. What might the reason be? Would it be down to the typolight installation, or is there something wrong with the database hosting?

    Many thanks!


    =======
    Fatal error: Uncaught exception Exception with message Could not connect to database (Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)) thrown in /home/fightforsightnew/htdocs/system/libraries/Database.php on line 70

    #0 /home/fightforsightnew/htdocs/system/libraries/Database.php(133): Database->__construct()
    #1 [internal function]: Database::getInstance()
    #2 /home/fightforsightnew/htdocs/system/libraries/System.php(132): call_user_func(Array)
    #3 /home/fightforsightnew/htdocs/system/libraries/Model.php(78): System->import('Database')
    #4 /home/fightforsightnew/htdocs/system/modules/backend/BackendUser.php(65): Model->__construct()
    #5 /home/fightforsightnew/htdocs/system/modules/backend/BackendUser.php(145): BackendUser->__construct()
    #6 [internal function]: BackendUser::getInstance()
    #7 /home/fightforsightnew/htdocs/system/libraries/System.php(132): call_user_func(Array)
    #8 /home/fightforsightnew/htdocs/typolight/index.php(59): System->import('BackendUser', 'User')
    #9 /home/fightforsightnew/htdocs/typolight/index.php(125): Index->__construct()
    #10 {main}

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: Error message / Could not connect to database

    This is usually what happens when TL can't connect to the database. Did this install used to work? Are you able to check the db with phpMyAdmin and MySQL Workbench?

  3. #3
    User
    Join Date
    06-19-09.
    Posts
    106

    Default Re: Error message / Could not connect to database

    All is good now. It must have been an issue with the hosting company. thanks fro getting back ben.

  4. #4
    New user
    Join Date
    01-12-10.
    Location
    Sumy, Ukraine
    Posts
    26

    Default Re: Error message / Could not connect to database

    Hi to all!

    I have the same problem. In new Contao installation http://.../contao/install.php gives an error:
    Code:
    Fatal error: Uncaught exception Exception with message Could not connect to database (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)) thrown in /home/vhosting/web05/*******/system/libraries/Database.php on line 78
    Is this something wrong with Contao configuration or it's just a hosting problem (I have send them a letter and waiting for answer)?

    Thanx.

  5. #5
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: Error message / Could not connect to database

    When do you receive this error message? My guess is that the db connection variables aren't correct. The host isn't always 'localhost'.

  6. #6
    New user
    Join Date
    01-12-10.
    Location
    Sumy, Ukraine
    Posts
    26

    Default Re: Error message / Could not connect to database

    When do you receive this error message?
    When trying to run Install tool.

    My guess is that the db connection variables aren't correct. The host isn't always 'localhost'.
    I tried to enter '121.0.0.1' and it gives me another error
    Code:
    Fatal error: Uncaught exception Exception with message Could not connect to database (Lost connection to MySQL server at 'reading initial communication packet', system error: 111) thrown in /home/vhosting/web05/*******/system/libraries/Database.php on line 78

  7. #7
    New user
    Join Date
    01-12-10.
    Location
    Sumy, Ukraine
    Posts
    26

    Default Re: Error message / Could not connect to database

    Just found the problem. I have to enter:
    Code:
    127.0.0.1
    not 121.0.0.1

    Thanx, Ben

  8. #8
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: Error message / Could not connect to database

    I understand that you receive the message in the install tool, but when specifically do you receive the error? Is it after enter the db connection details and clicking the button? Have you confirmed that all of the db connection details are correct? Has the db been created already and the user assigned to it with full permissions? Contao does not create the db, but only connects to an existing one. (You may already know all this, but I just wanted to cover in case you didn't.)

  9. #9
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: Error message / Could not connect to database

    Just saw your previous message ... glad you got it worked out and welcome to the Contao Community!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •