CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • [fixed] new install : database credentials problem
Pages: [1]

Author Topic: [fixed] new install : database credentials problem  (Read 3750 times)

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
[fixed] new install : database credentials problem
January 31, 2011, 03:32:22 am
I have tested on a local xampp install, and could install drupal + civirm just fine.

Now I'm trying to set it up on a production server and civicrm won't install.

I've set up drupal 6 (latest 6.x), the database name is smarttest and the db user is 'root'.
The server runs centos 5, php5 and mysql 5

I've downloaded and untarred civicrm 3.3.3, to /sites/all/modules/civicrm, and everything belongs to user apache, group apache.
/sites/all is world writable (777)
The l10n package is also installed.
I can find the installer in http -> servername/site/all/modules/civicrm/install/index.php

I type in my server, username, password and database but the installer can't see the db :

Quote from: install/index.php
Version 3.3.3 Drupal PHP5 31881
CiviCRM Installer

Thanks for choosing to use CiviCRM! Please follow the instructions below to get CiviCRM installed.

  (this will take a few minutes)
Database Version and Connection Settings

CiviCRM stores its content in a MySQL database. Please provide the username and password to connect to the server here. If this account has permission to create databases, then we will create the database for you; otherwise, you must give the name of a database that already exists.

Your database settings don't appear to be correct. Please check the Database Details below for specific errors.
CiviCRM Database Settings

MySQL server: localhost
MySQL username: root
MySQL password: xxxxx
MySQL database: smarttest
Drupal Database Settings

MySQL server:
MySQL username: root
MySQL password: xxxxx
MySQL database: smarttest
Other Settings

Language of basic data: French (France)
Load sample data: No
Check this box to pre-populate CiviCRM with sample English contact records, online contribution pages, profile forms, etc. These examples can help you learn about CiviCRM features.

CiviCRM Database Details
Does the server exist   OK (localhost)
Are the access credentials correct   That username/password doesn't work: Access denied for user 'apache'@'localhost' (using password: NO)
Can I access/create the database   I can't create new databases and the database 'smarttest' doesn't exist (user 'root' doesn't have CREATE DATABASE permissions.)
Can I access/create InnoDB tables in the database   Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server. Could not determine if mysql has innodb support. Assuming no
Can I create temporary tables in the database   Could not login to the database.
Can I create lock tables in the database   Could not login to the database.

Drupal Database Details
Does the server exist   OK (localhost)
Are the access credentials correct   That username/password doesn't work: Access denied for user 'apache'@'localhost' (using password: NO)
Can I access/create the database   The database does not exist


Requirements
PHP Configuration
PHP5 installed   OK (PHP version 5.2.10)
MySQL support   OK
JSON support   OK
Memory allocated (PHP config option 'memory_limit')   OK (256M)

File permissions
Does the webserver know where files are stored?   OK (/var/www/html/sites/all/modules/civicrm/install/)
does the CiviCRM path contain PATH_SEPARATOR?   OK (/var/www/html/sites/all/modules/civicrm/install/)
CRM folder exists   OK
packages folder exists   OK
templates folder exists   OK
js folder exists   OK
api folder exists   OK
i folder exists   OK
sql folder exists   OK
Is the sites/default/files folder writeable?   OK
Is the sites/default folder writeable?   OK

« Last Edit: February 01, 2011, 02:22:46 am by ehanuise »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: new install : database credentials problem
January 31, 2011, 04:18:42 am
If you're certain of the username and password (and you can confirm that by checking sites/default/settings.php to see what's there) then one possibility is the connection method. Drupal will install automatically using mysqli but CiviCRM only uses mysql. So sometimes a server can be configured for different default ports for mysqli vs mysql.

You can also see in settings.php if Drupal is using mysqli or mysql.

Let us know about that.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: new install : database credentials problem
January 31, 2011, 04:24:19 am
@hershel: you can use a config DSN with  "mysqli:..." on civicrm.settings

Quote from: ehanuise on January 31, 2011, 03:32:22 am
I've set up drupal 6 (latest 6.x), the database name is test and the db user is 'root'.

Security rule number 1: Never use root as the regular user on production server

Quote from: ehanuise on January 31, 2011, 03:32:22 am
/sites/all is world writable (777)

Actually, it means world executable as well as writable. You are giving way too much access rights

Security rule number 2: limit where apache can write to the strictly minimum possible. apache never need any executable PHP files.



Quote from: install/index.php
Version 3.3.3 Drupal PHP5 31881
MySQL server: localhost
MySQL username: root
MySQL password: xxxxx
MySQL database: smarttest

you say it's "test" but looks like  "smarttest" ?

Don't want to scare you, but I would suggest you to follow step by step the installation instructions on the wiki and the book and not take any shortcuts, given the little you are saying of your install, the smallest bug in any of the modules will make it quite easy to crack and get access to your site and its data.

Hosting on a public server is a different beast than on a local xampp, I'd suggest to read more about linux/apache security.

Good luck and may be see you at fosdem or drupal days ?

X+

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: new install : database credentials problem
January 31, 2011, 06:20:57 am
Xavier, security issues will be sorted out later, this is not the point but thanks anyways.
Once we get this running, we'll reduce perms and use a restricted user, of course.
The DB name is smarttest, so this is the correct value.
And we do set up on the LAN, and will move it to DMZ after a proper evaluation and security setup.


Now, back to the install problem :

Hershel : The drupal install does indeed use mysqli.
I checked out if it can be changed to mysql in drupal's settings (/sites/default/settings.php) but it breaks the drupal install so it's not a good option. Furthermore recent drupal installers disable mysql if mysqli is available on the server, so this config (drupal using mysqli) is the standard default.

Xavier : where can this (mysql => mysqli) be changed prior to installation ?

Thanks in advance!
« Last Edit: January 31, 2011, 06:39:30 am by ehanuise »

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: new install : database credentials problem
January 31, 2011, 06:51:20 am
Quote from: xavier on January 31, 2011, 04:24:19 am
@hershel: you can use a config DSN with  "mysqli:..." on civicrm.settings

Of course, but that's only after CiviCRM has been installed. What I meant is that the installer only supports mysql, not mysqli

Quote from: ehanuise on January 31, 2011, 06:20:57 am
Hershel : The drupal install does indeed use mysqli.
I checked out if it can be changed to mysql in drupal's settings (/sites/default/settings.php) but it breaks the drupal install so it's not a good option. Furthermore recent drupal installers disable mysql if mysqli is available on the server, so this config (drupal using mysqli) is the standard default.

So the issue is therefore your PHP and/or MySQL configuration, perhaps in fact the default port or default socket. If Drupal won't run with mysqli, then I think your options are either (1) Ask your sys admin to change whatever settings are necessary (adjusting php.ini may be enough) so that it does work. If you can get Drupal to run on mysql then CiviCRM should install just fine or (2) Attempt to adjust the CiviCRM installer to use mysqli. This would require knowledge of PHP to read the code and find where to try to change this.

A third option would be if the sys admin can provide alternative details for mysql to connect, such as a different port etc.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: new install : database credentials problem
January 31, 2011, 07:02:40 am
Quote from: hershel on January 31, 2011, 06:51:20 am
So the issue is therefore your PHP and/or MySQL configuration, perhaps in fact the default port or default socket. If Drupal won't run with mysqli, then I think your options are either (1) Ask your sys admin to change whatever settings are necessary (adjusting php.ini may be enough) so that it does work. If you can get Drupal to run on mysql then CiviCRM should install just fine or (2) Attempt to adjust the CiviCRM installer to use mysqli. This would require knowledge of PHP to read the code and find where to try to change this.

A third option would be if the sys admin can provide alternative details for mysql to connect, such as a different port etc.

Thanks a lot for your time :)

In fact, it's just the other way around :
Drupal was installed using mysqli. This works fine mysqli is OK for the drupal part.
We have set up a lot of things in Drupal (modules, contents, config, ...), and now we wish to add civicrm on the server and proceed with the configuration before we tightern security and move the server to dmz.
If we 'reset' drupal to mysql instead of mysqli in sites/default/settings.php, it doesn't work anymore, so we want to avoid that.

mysql and mysqli use the same socket and port :
Quote from: php.ini
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysql.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /var/lib/mysql/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
; mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; mysql.default_password =

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[MySQLi]

; Maximum number of links.  -1 means no limit.
mysqli.max_links = -1

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
 mysqli.default_socket = /var/lib/mysql/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
; mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off

[mSQL]
; Allow or prevent persistent links.
msql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
msql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
msql.max_links = -1


I'll try moving mysql to another port, and see if it helps.
I checked the civicrm installer code, and didn't find where it can be changed from mysql:// to mysqli://
Are there manual installation infos somewhere ?

It's a pity mysqli isn't suported out of the box :(

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: new install : database credentials problem
January 31, 2011, 07:06:52 am
If you can get mysql to work, same as mysqli does, then Drupal would work exactly as it does, with mysql or mysqli. It should make no perceivable difference.

But the truth is that if you are migrating from another server, even a local one, you don't technically need to install--you could just follow the instructions carefully here http://wiki.civicrm.org/confluence/display/CRMDOC32/Moving+an+Existing+Installation+to+a+New+Server+or+Location and use mysqli for the CiviCRM connect strings and it should work fine.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: new install : database credentials problem
January 31, 2011, 07:12:59 am
I'll investigate the mysql part in depth then, thanks.

Regarding civicrm, that part is a fresh install unfortunately.

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: new install : database credentials problem
January 31, 2011, 08:00:36 am
OK, it seems it's a mysql-php issue.
If I run this, with of course the correct username/password
Quote
<?php
$dbcnx = @mysql_connect('localhost', 'root','password');

if (!$dbcnx)
{
  die ("<p>Unable to connect to the database server at this time.</p>\n" . "<p>" . mysql_error() . "</p>\n");
}
echo "<p>Connected to the database server!</p>\n";
echo "</p>\n";
echo "<p>End of script!</p>";
?>

I get this result :
Unable to connect to the database server at this time.

Access denied for user 'apache'@'localhost' (using password: NO)

So, somehow, the user credentials 'root@localhost' are transmogrified to 'apache@localhost'.

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: new install : database credentials problem
February 01, 2011, 02:22:30 am
It was indeed a mysql/php issue, unrelated to Civicrm.

I tried several things, then uninstalled and reinstalled the whole stack (mysql, php, php-mysql, php-dev, php-gd, php-pear, php-ldap, ....)
Now the test code provides successful connections, ans sure enough the civicrm installer works just fine  8)


Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: [fixed] new install : database credentials problem
February 01, 2011, 04:22:32 am
Very good. Thanks for reporting back. Let us know if we can help with anything else.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • [fixed] new install : database credentials problem

This forum was archived on 2017-11-26.