## Installing and upgrading help

### (2.4) Installation in Freebsd Database connection failed

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
(2.4) Installation in Freebsd Database connection failed

please help my project to install moodle in freebsd , i installed mysql 5.5.30 ,php 5.4.10, and apache 2.4.3

i can connect to phpinfo and connect to mysql, but when i want to install moodle, i get some 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

Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in/usr/local/apache2/htdocs/moodle/lib/dml/mysqli_native_moodle_database.phpon line 76"

and i change config-dist.php to config.php and change some variable, after that i got "

Error: Database connection failed

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

i installed php with configuration : ./configure --prefix=/usr/local/apache2/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/php --disable-cgi --with-zlib=/usr/local/zlib --with-gettext=/usr/local/gettext --with-gdbm=/usr/local/gdbm --with-libxml-dir=/usr/local/libxml2 --with-xsl=/usr/local/libxslt --with-iconv=/usr/local/libiconv --enable-mbstring --with-mysqli=mysqlnd

Average of ratings: -
Re: (2.4) Installation in Freebsd Database connection failed
Let us say, your config.php has these four lines:
$CFG->dbhost = 'localhost'; // eg 'localhost' or 'db.isp.com' or IP$CFG->dbname = 'dbname'; // database name, eg moodle
$CFG->dbuser = 'dbuser'; // your database username$CFG->dbpass = 'dbpasssword'; // your database password

then the MySQL user dbuser must have full access to the database dbname in the localhost.
You can test it easily by logging in to MySQL through the command line tool called mysql:

\$ mysql -u dbuser -p
Enter password: [dbpass]
mysql> use dbname;
...
Database changed

i.e. the out come should be postivve, no "Access denied".

The source of the above is http://docs.moodle.org/22/en/Installing_Moodle_on_Debian_based_distributions#Create_a_database_and_a_user (which is also valid for Moodle 2.4). For more generic Unix instructions, see http://docs.moodle.org/24/en/Unix_or_Linux_Installation.

Average of ratings: -
Re: (2.4) Installation in Freebsd Database connection failed

yes i already checked it and i can access.

now i can access the database, i use phpmyadmin and grant all in the privileges.

Thx sir for help.

oh now i got error when i want to compile GD ,

./configure --with-jpeg --with-png --with-xpm, but i can't compile xpm , i don't know where can i download the source for xpm ..

and if i ignore the xpm, when i make install the configure in GD, i get error in gd_jpeg.c, like the source had some error code for FreeBSD.

Average of ratings: -
Re: (2.4) Installation in Freebsd Database connection failed
Hi

You wrote:
> yes i already checked it and i can access.
> now i can access the database,

What was the problem exactly?

> oh now i got error when i want to compile GD ,
> ./configure --with-jpeg --with-png --with-xpm, but i can't compile xpm , i don't know where can i download the source for xpm ..

Do you need to compile GD separately? I thought you need only the GD module in PHP. Check http://docs.moodle.org/24/en/PHP.

Anyway, this is a forum on Moodle. We assume system software as described in http://docs.moodle.org/24/en/Installing_Moodle#Requirements. For problems as system software level you need to consult other sources: the corr. community, books, tutorials, whatever.

Average of ratings: -
Re: (2.4) Installation in Freebsd Database connection failed

oh sorry, i mean when i post the first post, i can access mysql, but the moodle show the database error. and after u reply, i already can fix it by phpmyadmin to grant all privileges.

Average of ratings: -