MySQL connection nonsense Debian stable

MySQL connection nonsense Debian stable

by Douglas Shawhan -
Number of replies: 4
I get the usual "We could not connect to the database you specified. Please check your database settings." balderdash during setup.

However, using the following:
<?php
mysql_connect("localhost", "moodleuser", "extrasecretness") or die(mysql_error());echo "Connected to MySQL<br />";
?>
I have established that php can apparently connect to mysql.

I am using:
Apache 2.0.5.4-5
PHP 4
MySQL 4.1
Debian Stable.

What else can I try to figure this out? I attempted to bypass all this and go with Postgresql (which I have used and "understand") but was rewarded with many white pages. mixed

I am sure this has been answered in a blue million different ways. mixed

Thanks!

Average of ratings: -
In reply to Douglas Shawhan

Re: MySQL connection nonsense Debian stable

by Martín Langhoff -
If you are using the fine Moodle Debian package, there are some notes in /usr/share/doc/moodle that explain how it expects to find its database.

I run Moodle of the debian package on a few boxes (MySQL and PostgreSQL) and once you've done what the module wants, it's all sweet. It's been a long time, though, and I don't remember the details, other than having to read things under /usr/share/doc.
(Shame on me! I'm supposed to be helping Isaac with the packaging and I can't even remember what the install instructions are!)

Otherwise, it could be that it is literally wanting to connect to "localhost" over TCPIP instead of the socket. Debian's MySQL defaults to only listening to the unix socket.
In reply to Martín Langhoff

Re: MySQL connection nonsense Debian stable

by Douglas Shawhan -
" Otherwise, it could be that it is literally wanting to connect to "localhost" over TCPIP instead of the socket. Debian's MySQL defaults to only listening to the unix socket."

Is this something I can fudge past in moodle's install process or is it something hideous and gnarled in my server setup?
In reply to Douglas Shawhan

Re: MySQL connection nonsense Debian stable

by Penny Leach -
From memory, you can set $CFG->dbhost to be '' rather than localhost, I think that forces it to try sockets rather than tcp/ip.

In reply to Martín Langhoff

Re: MySQL connection nonsense Debian stable

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
In fact, Debian Sarge's default config for MySQL is to listen on "127.0.0.1 TCP:3306" too (they used to include 'skip-networking' in my.cnf, but they no longer do).

Saludos. Iñaki.