1

Topic: Database error

==== Required information ====
- iRedMail version: 0.8.6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Centos  6.5
- Related log if you're reporting an issue:
====
Hello.
When you install iredmail

< INFO > Configure MySQL database server.
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password:YES)
ERROR 1045 (28000):Access denied for user 'root'@'localhost' (using password:YES)

After installation there are no databases and users except than root.

2

Re: Database error

iRedMail requires a new/fresh/clean server for installation. So, my questions are:

*) is your server a fresh/clean one before iRedMail installation?
*) Do you have MySQL server running and have mysql root password set before iRedMail installation?

3

Re: Database error

Yes,installed on a fresh system. Before installing only did yum update.
MySQL и MySQL server were not installed before iredmail.
The first time I face this problem.

4

Re: Database error

I have no idea if you cannot provide futher debug message. The easiest way to solve it is trying to install iRedMail on a fresh/clean server again.

5 (edited by vlad 2014-02-16 21:45:08)

Re: Database error

I have already installed three times on fresh system.
where to get debug message ?

6

Re: Database error

vlad wrote:

I have already installed three times on fresh system.

Could you please check whether mysql is installed manually before iRedMail installation? For example:

# rpm -qa | grep -i mysql

We tested CentOS many times, no issue at all.

7

Re: Database error

On a fresh system when entering the command rpm -qa | grep -i mysql  out mysql-libs-5.1.73-3.el6_5.x86_64.


Maybe I'm wrong to edit the file hosts ?

Initially, the file had such content:

127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6


Before installing iredmail I changed the contents of a file hosts this


127.0.0.1  mx.mysite.com localhost localhost.localdomain
::1        localhost localhost.localdomain


Also, I noticed after installation iredmail in phpmyadmin is listed in three root  users and 3 anonymous user.
No more users and databases (except for mysql) do not appear.

I installed several times before iredmail on centos 6.5. But confronted with this problem for the first time.

This problem occurs on a particular server.

8

Re: Database error

It's hard to say what the problem is without debug. Could you please modify file 'functions/backend.sh' like below and try again?

*) Find below line in functions/backend.sh:

    elif [ X"${BACKEND}" == X"MYSQL" ]; then                                       
        ECHO_INFO "Configure MySQL database server."                               
        mysql_generate_defauts_file_root                                           
        if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then                        
            check_status_before_run mysql_initialize                               
        fi                                                                         
        check_status_before_run mysql_import_vmail_users

*) Add two lines there: One is 'set -x', another one is 'set +x':

    elif [ X"${BACKEND}" == X"MYSQL" ]; then                                       
        ECHO_INFO "Configure MySQL database server."
        set -x
        mysql_generate_defauts_file_root
        if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then
            check_status_before_run mysql_initialize
        fi
        check_status_before_run mysql_import_vmail_users
        set +x

*) Save above change, then install this modified iRedMail on this server (must be a new/fresh/clean server).

9

Re: Database error

Before installing iredmail I changed the contents of the hosts file on 

127.0.0.1  mx.site.com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6

I also changed the file backend.sh as you wrote.



iredmail installed without errors.


C using the above code

elif [ X"${BACKEND}" == X"MYSQL" ]; then                                       
        ECHO_INFO "Configure MySQL database server."
        set -x
        mysql_generate_defauts_file_root
        if [ X"${USE_LOCAL_MYSQL_SERVER}" == X'YES' ]; then
            check_status_before_run mysql_initialize
        fi
        check_status_before_run mysql_import_vmail_users
        set +x





iredmail can be installed without errors or it shows an error?


But I do not know what the problem was?

10

Re: Database error

With modified functions/backend.sh, it will print debug message about how the shell scripts work, so that we can dig deeper to try to understand why your issue happened.

11 (edited by blinden 2014-02-20 01:23:53)

Re: Database error

I'm having the same issue with Ubuntu 12.04 LTS.

I've tried with a completely clean install with the only non-default package being ssh server, got these exact errors.

After trying that twice, I also tried to do the install with doing the mysql install and setting the password BEFORE the install, and that also failed with the exact same issue.

I confirmed that the password in the config file is the password I expected. I'll try to add this lines in the backend.sh shortly and report back.

Edit---

Doing the Fresh/Clean install now with the modified .sh, Just finished doing the ubuntu 12.04 reinstall. I noticed that (and this was the same way on the previous installs) that the dialog boxes seem to have some amount of corruption in them (attached file), but the config file seems to have the proper data in it.

Post's attachments

iredinstall1.png 19.98 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

12

Re: Database error

< INFO > Create self-signed SSL certification files.
< INFO > Create required system accounts: vmail, iredapd, iredadmin.
< INFO > Configure Apache web server and PHP.
< INFO > Configure MySQL database server.
+ mysql_generate_defauts_file_root
+ ECHO_DEBUG 'Generate temporary defauts file for MySQL client option --defaults-file: /root/iRedMail-0.8.6/.mysql-root-defaults-file.'
+ '[' XNO == XYES ']'
+ :
+ cat
+ '[' XYES == XYES ']'
+ check_status_before_run mysql_initialize
+ _status=status_mysql_initialize
++ eval echo '$status_mysql_initialize'
+++ echo
+ '[' X '!=' XDONE ']'
+ mysql_initialize
+ ECHO_DEBUG 'Starting MySQL.'
+ '[' XNO == XYES ']'
+ :
+ '[' XUBUNTU == XOPENBSD ']'
+ freebsd_enable_service_in_rc_conf mysql_enable YES
+ '[' XUBUNTU == XFREEBSD ']'
+ ECHO_DEBUG 'Copy sample/my.cnf to /etc/mysql/my.cnf.'
+ '[' XNO == XYES ']'
+ :
+ '[' '!' -f /etc/mysql/my.cnf ']'
+ perl -pi -e 's#^(skip-networking.*)#${1}#' /etc/mysql/my.cnf
+ grep '^innodb_file_per_table' /etc/mysql/my.cnf
+ '[' X1 '!=' X0 ']'
+ perl -pi -e 's#^(\[mysqld\])#${1}\ninnodb_file_per_table#' /etc/mysql/my.cnf
+ /etc/init.d/mysql restart
+ ECHO_DEBUG 'Sleep 5 seconds for MySQL daemon initialize ...'
+ '[' XNO == XYES ']'
+ :
+ sleep 5
+ '[' X127.0.0.1 == X127.0.0.1 ']'
+ mysql -uroot -e 'show databases'
+ '[' X0 == X0 ']'
+ ECHO_DEBUG 'Setting password for MySQL admin (root).'
+ '[' XNO == XYES ']'
+ :
+ mysqladmin --user=root password XXXXXXXXXXXXXX
+ echo ''
+ cat
+ ECHO_DEBUG 'Initialize MySQL database.'
+ '[' XNO == XYES ']'
+ :
+ mysql --defaults-file=/root/iRedMail-0.8.6/.mysql-root-defaults-file
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+ cat
+ echo 'export status_mysql_initialize="DONE"'
+ check_status_before_run mysql_import_vmail_users
+ _status=status_mysql_import_vmail_users
++ eval echo '$status_mysql_import_vmail_users'
+++ echo
+ '[' X '!=' XDONE ']'
+ mysql_import_vmail_users
+ ECHO_DEBUG 'Generating SQL template for postfix virtual hosts: /root/iRedMail-0.8.6/conf/mysql_vmail.sql.'
+ '[' XNO == XYES ']'
+ :
++ gen_md5_passwd XXXXXXXXX
++ openssl passwd -1 XXXXXXXXX
+ export 'DOMAIN_ADMIN_PASSWD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ DOMAIN_ADMIN_PASSWD='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
++ gen_md5_passwd XXXXXXXX
++ openssl passwd -1 XXXXXXXX
+ export 'FIRST_USER_PASSWD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ FIRST_USER_PASSWD='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
+ perl -pi -e 's#(.*storagebasedirectory.*DEFAULT).*#${1} "$ENV{STORAGE_BASE_DIR}",#' /root/iRedMail-0.8.6/samples/iredmail.mysql
+ perl -pi -e 's#(.*storagenode.*DEFAULT).*#${1} "$ENV{STORAGE_NODE}",#' /root/iRedMail-0.8.6/samples/iredmail.mysql
+ cat
+ ECHO_DEBUG 'Import postfix virtual hosts/users: /root/iRedMail-0.8.6/conf/mysql_vmail.sql.'
+ '[' XNO == XYES ']'
+ :
+ mysql --defaults-file=/root/iRedMail-0.8.6/.mysql-root-defaults-file
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+ cat
+ echo 'export status_mysql_import_vmail_users="DONE"'
+ set +x
< INFO > Configure Postfix (Message Transfer Agent).
< INFO > Configure Cluebringer (postfix policy server).
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
< INFO > Configure Dovecot-2 (pop3/imap/managesieve server).
< INFO > Configure ClamAV (anti-virus toolkit).
< INFO > Configure Amavisd-new (interface between MTA and content checkers).
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
< INFO > Configure SpamAssassin (content-based spam filter).
< INFO > Configure iRedAPD (postfix policy daemon).
< INFO > Configure iRedAdmin (official web-based admin panel).
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
< INFO > Configure Fail2ban (authentication failure monitor).
< INFO > Configure Awstats (logfile analyzer for mail and web server).
< INFO > Configure Roundcube webmail.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
< INFO > Configure phpMyAdmin (web-based MySQL management tool).

*************************************************************************
* iRedMail-0.8.6 installation and configuration complete.
*************************************************************************

< INFO > Mail sensitive administration info to postmaster@XXXXXXXX.

13

Re: Database error

Looking through the mysql error log now, at the install time I have these errors, not sure if they are related:

ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1

140219 12:26:28 [ERROR] Aborting

14

Re: Database error

Should I open this in a separate thread since it's a slightly (different distro) issue? I didn't want to clutter the forum too much.

15

Re: Database error

blinden wrote:

ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1

This error confuses me. iRedMail doesn't have SQL command to alter sql table "mysql.user", not sure why it happened.
Is there any restrictions in your MySQL server configuration file (my.cnf)?

16

Re: Database error

User error.

I'm ashamed to admit, but I will put this out there just for anyone that ends up searching for the same issue. I didn't follow the "no special characters" in the password rule.

Everything seems to work fine now.