1

Topic: freebsd install mysql service startup failed

==== Required information ====
- iRedMail version: 0.9.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  LDAP
- Web server (Apache or Nginx): Apache
- Linux/BSD distribution name and version:  freebsd 10 ezjail
- Related log if you're reporting an issue:
====

I try to install latest version inside freebsd 10.
I found mysql startup script in /usr/local/etc/rc.d/ is mysql-server, but the the script in the rc.conf is mysql_enable=true.
And then all the mysql initialization script not execute.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: freebsd install mysql service startup failed

Check /usr/local/etc/rc.d/mysql-server, it uses 'mysql_enable'.
Any error message during iRedMail installation? Any error in file iRedMail-0.9.1/runtime/install.log?

3

Re: freebsd install mysql service startup failed

ZhangHuangbin wrote:

Check /usr/local/etc/rc.d/mysql-server, it uses 'mysql_enable'.
Any error message during iRedMail installation? Any error in file iRedMail-0.9.1/runtime/install.log?

when i execute service mysql start, it said can not find script rc.d/mysql
I have to change the script name to rc.d/mysql to startup the service
I check the runtime log, there is no error, but it seem like the init script is skipped.
"< SKIP > Function: mysql_initialize."

4

Re: freebsd install mysql service startup failed

why not try 'service mysql-server start'?

5

Re: freebsd install mysql service startup failed

ZhangHuangbin wrote:

why not try 'service mysql-server start'?

root@mx:/usr/local/etc/rc.d # ls mysql*
mysql-server
root@mx:/usr/local/etc/rc.d # service mysql start
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)
root@mx:/usr/local/etc/rc.d # mv mysql-server mysql
root@mx:/usr/local/etc/rc.d # service mysql start
Starting mysql.
root@mx:/usr/local/etc/rc.d #

6

Re: freebsd install mysql service startup failed

Did you read my reply?

why not try 'service mysql-server start'?

Why force yourself to use 'service mysql start' instead of 'mysql-server'?

7

Re: freebsd install mysql service startup failed

ZhangHuangbin wrote:

Did you read my reply?

why not try 'service mysql-server start'?

Why force yourself to use 'service mysql start' instead of 'mysql-server'?

service mysql-server start
works..
how can I init the mysql database manually?

8

Re: freebsd install mysql service startup failed

I suggest you reinstall OS (or restore the Jail) then install iRedMail again. Because it's more complex to initial/import SQL databases manually.

You should create databases for virtual mail accounts, Roundcube webmail, Cluebringer, etc.

9

Re: freebsd install mysql service startup failed

ZhangHuangbin wrote:

I suggest you reinstall OS (or restore the Jail) then install iRedMail again. Because it's more complex to initial/import SQL databases manually.

You should create databases for virtual mail accounts, Roundcube webmail, Cluebringer, etc.

I reinstall the jail and it seems like the mysql database is still not initialized.
I check the install log:
grep ERR install.log                                         
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

then I check mysql database:
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.24 Source distribution

Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.03 sec)

10

Re: freebsd install mysql service startup failed

I figure it out, it's a bug in iRedMail-0.9.1. Please try this patch:

diff -r aebeab2b5bc9 iRedMail/functions/mysql.sh
--- a/iRedMail/functions/mysql.sh    Sat May 23 13:07:19 2015 +0800
+++ b/iRedMail/functions/mysql.sh    Sat May 23 22:04:29 2015 +0800
@@ -36,11 +36,16 @@
     ECHO_DEBUG "Generate temporary defauts file for MySQL client option --defaults-file: ${MYSQL_DEFAULTS_FILE_ROOT}."
     cat >> ${MYSQL_DEFAULTS_FILE_ROOT} <<EOF
 [client]
-#host=${MYSQL_SERVER}
-#port=${MYSQL_SERVER_PORT}
 user=${MYSQL_ROOT_USER}
 password=${MYSQL_ROOT_PASSWD}
 EOF
+
+    if [ X"${LOCAL_ADDRESS}" != X'127.0.0.1' ]; then
+        cat >> ${MYSQL_DEFAULTS_FILE_ROOT} <<EOF
+host=${MYSQL_SERVER}
+port=${MYSQL_SERVER_PORT}
+EOF
+    fi
 }
 
 mysql_initialize()

11

Re: freebsd install mysql service startup failed

The patch works!

Thanks!