Forums | Mahara Community

Support /
Problem with database connection


anonymous profile picture
Account deleted
Posts: 6

29 July 2013, 6:16

Hi,

I've tried to install mahara 1.7 on Netsons provider (hosting Linux) but, during the installation, appears the following message:

Mahara could not connect to the application database.

* If you are using Mahara, please wait a minute and try again
* If you are the administrator, please check your database settings and make sure your database is available

The error received was:
mysql error: [2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)] in CONNECT(localhost, 'database_user', '****', database_name)

Obviously, I've changed here for privacy reason the real database name and the real database user.

 

In my config.php I've set following values:

$cfg->dbtype = 'mysql5';
$cfg->dbhost = 'localhost';
$cfg->dbport = null;
$cfg->dbname = 'database_name';
$cfg->dbuser = 'database_user';
$cfg->dbpass = 'database_password';

Someone could tell me If Ive forgotten something or if I've done something wrong?

 

Thank you 

 

Aaron Wells's profile picture
Posts: 896

29 July 2013, 11:22

Hi Cristiano,

That configuration looks correct. Check that you've got the correct username, password, and database name. MySQL access permissions are on a per-host basis, so make sure that you've got it configured so that user can connect from the localhost.

If you've got command-line access to your host, you can test your connection info using the mysql command-line utility:

mysql -h localhost -u database_user -D database_name -p

Cheers,

Aaron

anonymous profile picture
Account deleted
Posts: 6

30 July 2013, 9:12

Hi Aaron,

 

thank you so much for your help.

As first step, I've checked the data access and they are correct.

As second step...well I have no command line access to my host and iI configure databases and tables with phpmyadmin interface and I don't understand very well what you are saying. Please, could you explain what I can do in 1O1 style? ^^'

anonymous profile picture
Account deleted
Posts: 48

31 July 2013, 10:07

Hi  Cristiano:

In some shared hostings "localhost" doesn't work. A simple google search gave me this instructions for mysql databases in Netsons (check also the full name for the database and user):

http://www.netsons.com/knowledgebase.php?action=displayarticle&id=19

Buona fortuna!

anonymous profile picture
Account deleted
Posts: 6

03 August 2013, 8:53

Hi Roberto,

thanks for your help! In config file I've changed "localhost" with "mysql.netsons.com" and it works! But after this step I've a new problem. In the next step there is this warning:

"You are not using a UTF-8 database. Mahara stores all data as UTF-8 internally. Please drop and re-create your database using UTF-8 encoding."

But If I check my database I can see I'm using utf8_general_ci encoding. What I'm doing wrong now?

 

anonymous profile picture
Account deleted
Posts: 48

04 August 2013, 11:11

Hi Cristiano:

I had a similar problem. From phpMyAdmin make sure that both the database and the tables are using utf8_general_ci encoding, at the end of the DB structure (I can't load an image in this group to show you exactly where you can find it).

 

anonymous profile picture
Account deleted
Posts: 6

05 August 2013, 8:49

Hi Roberto,

thank you for your patience! I've modified the tables encoding (it was set on latin1_danish_ci). Now the warnig message doesn't appear anymore but appears just a blank page and no one tables has been created into database. I'm sorry for all these posts. I usually prefer to do it myself but I do not know mahara and do not know how to solve these problems Yell

05 August 2013, 13:58

Hello Christano,

The difficulty to install an OpenSource solution on a web-php-mysql server is not related to the solution itself but requires network and technical webserver knowledge. I say that confortably because I also was a newbie and had to learn it by the book and with the help of the others.

In your situation, it seems that you can't access your server with a Terminal (SSH) software, but really can't you? According to your provider's knowledge base (http://www.netsons.com/knowledgebase.php?action=displayarticle&id=142) you could normaly do it. The advantage of having a full SSH access to your server is that you then would be able to manage each part of it more efficiently.

Coming back to your actual installation problem, I would suggest to do/check the following things :

  • delete/recreate the database from scratch and ensuring you are using utf8_general_ci for the database and the tables
  • check the information in your config.php, but they should be ok because no error was displayed after your last try
  • check the right given to the folders where you have "maharadata" and the root folder for your Mahara web site. Theses folders must have 755 for the rights (meaning full access for the owner and reading access for the group and all the other users) and the owner and the group must be set in correspondance to the web-username and web-group name, which are normally "www-data" for both or "www".

It is difficult for the readers of this forum to help you without knowing what happens to your surver during the installation or when something is going wrong. Your Apache / PHP / MySQL services are storing important information about errors and processes in log files. It would be important to locate these files on your hosted server to look into them for more details about the errors or about what happened during a faulty process.

Don't give up, the learning curve is sometime high, but everything will be ok at the end, and if it is not ok, it means this is not the end.

Regards,

-dajan

anonymous profile picture
Account deleted
Posts: 6

08 August 2013, 10:10

Hi Dajan,

Unfortunately, the access via ssh terminal is not allowed for free hosting but only for the dedicated server service, so I can not access through ssh terminal.

As for the other points of your answer:

I already tried to delete and recreate the database with no result
I checked the config.php file but there isn't errors
The permissions of folders which you have mentioned are already set over 775

Maybe the problem is somewhere else. I'll try to fix it somehow but in the meantime thanks for suggestions.

Cristiano

08 August 2013, 11:02

Hello Christiano

Sorry about that

Could you request some help of your internet provider about the database set up?

Regards
-dajan
12 results