Unable to connect to the database

Discussion in 'Installation/Configuration' started by Wsbs9GC, Oct 12, 2012.

  1. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    Hello.
    First, a bit about my setup:
    I followed one of the perfect server guides and all processes are on the same machine.
    The Problem:
    After a system restart, my ispconfig 3 installation throws the errors:
    • Unable to connect to the database
    • Unable to connect to the database:
    Notice the difference of the ending colon between the two. I have checked the information in /usr/local/ispconfig/server/lib/config.inc.php and /usr/local/ispconfig/server/lib/mysql_clientdb.conf as suggested in other threads and that information is correct. I have verified this by trying to log into mysql directly with mysql -u user -p and then pasting in the password in those files above. There are no errors in /var/log/mysql.err nor an entries in /var/log/mysql.log so it appears, at least to me, that a connection is never made to the mysql server. I then did some searching around and in /var/log/ispconfig/cron.log there is
    Code:
    Found linux image: /boot/vmlinuz-3.2.0-31-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-31-generic-pae
    Found linux image: /boot/vmlinuz-3.2.0-23-generic-pae
    Found initrd image: /boot/initrd.img-3.2.0-23-generic-pae
    Found memtest86+ image: /memtest86+.bin
    done
    PHP Warning:  mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php on line 276
    PHP Warning:  mysql_error() expects parameter 1 to be resource, boolean given in /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php on line 278
    PHP Warning:  mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO) in /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php on line 133
    PHP Warning:  mysql_error() expects parameter 1 to be resource, boolean given in /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php on line 135
    
    Upon checking the file in question, I could not find any place within the file that sets the $clientdb_user and $clientdb_password variables.
    What do I need to do to fix this problem and, if you wouldn't mind at least speculating, what caused this issue in the first place? All was working fine until a system restart.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please test your mysql server with this command:

    mysql -h localhost -u root -p

    and then enter the mysql root password from the file /usr/local/ispconfig/server/lib/mysql_clientdb.conf
     
  3. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    Testing with mysql -h localhost -u root -p and then pasting in the password that is in /usr/local/ispconfig/server/libmysql_clientdb.conf allows me to connect:
    Code:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1612
    Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
    
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Pk, then the errors in the log are most likely old and have been fixed already, as the file /usr/local/ispconfig/server/libmysql_clientdb.conf conatins the variables with the passwords that are used in the file /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php to connect to the server when a client new database is created in ispconfig.
     
  5. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    They are not old. I've deleted the entries in the log and tried to create a new client database and after the job goes through the queue, I get those errors stated above in the log again, with a current timestamp.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you use any special chars in your mysql password, if yes, change it to use only A-z a-z and numbers and tra again.
     
  7. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    No special characters. It is an alphanumeric password.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    And you use ispconfig 3.0.4.6 and have not modified any sourcecode or installed any third party plugins or addons in ispconfig?
     
  9. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    I am using ispconfig 3.0.4.6 (per the html title of the admin pages) and have not modified any sourcecode nor installed any 3rd party plugins or addons.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    According to je error message, the mysql password is empty but you said it is not empty and no files were altered, so maybe a file got corrupted. You should ownload the latest ispconfig again, unpack it and run the update.php script ehich is in he intall folder. Choose to reconfigure services during update.
     
  11. Wsbs9GC

    Wsbs9GC New Member HowtoForge Supporter

    Thank you, Till. What you suggested worked just fine.

    To those who may have a similar problem in the future please try this sequence of commands to repair your installation:
    Code:
    sudo su
    cd /tmp
    wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
    tar xfz ISPConfig-3-stable.tar.gz
    cd ispconfig3_install/install/
    php -q update.php
    
    Then just follow the defaults in the update script if you are using a single server to run all the services that this package administers. Note though that if you have made changes to postfix for smtp relay, you will have to redo those changes manually.
     

Share This Page