+ Post New Thread
Results 1 to 7 of 7
*nix Thread, Moodle Database won't connect in Technical; I'm trying to set up a Moodle box. I've edited the config.php to relect the correct detail, but when I ...
  1. #1
    StewartKnight's Avatar
    Join Date
    Jun 2005
    Posts
    1,587
    Thank Post
    2
    Thanked 27 Times in 21 Posts
    Rep Power
    30

    Moodle Database won't connect

    I'm trying to set up a Moodle box.

    I've edited the config.php to relect the correct detail, but when I goto to the web page, I get this error:

    "Error: Database connection failed.

    It is possible that the database is overloaded or otherwise not running properly.

    The site administrator should also check that the database details have been correctly specified in config.php"

    Can anyone help please!

    EDIT: I've sussed this problem, but be prepared for more!!!

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,993
    Thank Post
    120
    Thanked 286 Times in 263 Posts
    Rep Power
    107

    Re: Moodle Database won't connect

    Write the solution then so its not a dead end for anyone searching

  3. #3

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,808
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Moodle Database won't connect

    On the database side of things check:

    1. The database server is running.
    2. the moodle database has been created
    3. the moodle database user has been created, assigned a password and host access.
    4. the moodle database user has correct access to the moodle database

    On the moodle side of things check:

    1. There's actual network connectivity between your webserver and database server.
    2. PHP has support for your database server compiled in.
    3. The config.php has the correct server address and database type set for your database server.
    4. The config.php has the correct username/password for your moodle database.
    5. There's no spurious spaces or blank lines after the last character in the config.php

  4. #4
    StewartKnight's Avatar
    Join Date
    Jun 2005
    Posts
    1,587
    Thank Post
    2
    Thanked 27 Times in 21 Posts
    Rep Power
    30

    Re: Moodle Database won't connect

    the solution to my problem was:

    when I altered the config.php, I gave "root" access to the db, AND i typed in the root password. I had to leave the p/wrd blank!

    Now of course, I have different problems

  5. #5

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,808
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Moodle Database won't connect

    Quote Originally Posted by StewartKnight
    when I altered the config.php, I gave "root" access to the db, AND i typed in the root password. I had to leave the p/wrd blank!
    Bad! You just failed Linux Database Security 101 on two counts:

    1. The database root user has no password.
    2. Moodle is using the root user account.

    Why?

    1. anyone logging on to a shell can do what they want with your databases.

    2. If there's an exploit in moodle that allows access to the underlying database server an attacker can gain access to any database on the database server.

    Recommendations are:

    1. Set a password for the database server root user. Preferably a long (12+ characters) one containing numbers letters (upper and lower case) and special charaters. Check if your distro has the 'makepasswd' tool for automatically generating strong passwords.

    2. Create a moodle database user with a strong password (see above) that only has access to the moodle database on the database server.

    3. Setup host based access for your database users. If everthings on one machine 'localhost' is sufficent.

  6. #6
    StewartKnight's Avatar
    Join Date
    Jun 2005
    Posts
    1,587
    Thank Post
    2
    Thanked 27 Times in 21 Posts
    Rep Power
    30

    Re: Moodle Database won't connect

    I know I commited the cardinal sin, but it's a machine only I have access to, and then, if I can get the bloody thing to work, I'll change the settings.

    I've got to the point where it should be asking me to create a toplevel administrator, but it's not, the page is blank. Any ideas Geoff?

  7. #7

    Geoff's Avatar
    Join Date
    Jun 2005
    Location
    Fylde, Lancs, UK.
    Posts
    11,808
    Thank Post
    110
    Thanked 583 Times in 504 Posts
    Blog Entries
    1
    Rep Power
    224

    Re: Moodle Database won't connect

    Usually the result of a syntax error in a configuration file or missing libraries.

SHARE:
+ Post New Thread

Similar Threads

  1. Joomla : Unable to Connect to Database
    By deano in forum Web Development
    Replies: 0
    Last Post: 28th September 2007, 03:09 PM
  2. Replies: 6
    Last Post: 11th July 2007, 03:32 PM
  3. Connect to Moodle with File DSN
    By themaverickman in forum Virtual Learning Platforms
    Replies: 0
    Last Post: 9th July 2007, 02:47 PM
  4. Replies: 4
    Last Post: 28th February 2007, 09:37 AM
  5. ASP connect to SIMS database
    By ryan_powell in forum MIS Systems
    Replies: 1
    Last Post: 26th October 2006, 06:31 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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