1 (edited by Rashef 2018-10-04 23:36:20)

Topic: Force iRedMail to install (and use) a TCP connection with MySQL

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,

I am trying to install iRedMail on a machine that is connected to another machine's MariaDB via SSH tunnerl - therefore if I do:

$ mysql -h 127.0.0.1 -uroot -p

I actually connect to MariaDB installed on the remote machine.

Following this page (https://docs.iredmail.org/install.iredm … erver.html) I tried installing iRedMail with:

USE_EXISTING_MYSQL='YES' MYSQL_SERVER_ADDRESS='127.0.0.1' MYSQL_SERVER_PORT='3306' MYSQL_ROOT_USER='admin_iredmail' MYSQL_ROOT_PASSWD='admin_password' MYSQL_GRANT_HOST='127.0.0.1' bash iRedMail.sh

but the installation process keeps trying using the socket instead of establishing a TCP connection:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Is there a way to force the installation - and then the whole solution - to use TCP? Looking at the script it looks like if

MYSQL_SERVER_ADDRESS = 127.0.0.1

it will treat it as localhost - which defaults to socket.

----

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

2 (edited by Rashef 2018-10-05 14:33:46)

Re: Force iRedMail to install (and use) a TCP connection with MySQL

Just to add a little bit of context.

I have two machines (MAIL and DB). The tunnel is active and is making MariaDB (installed on DB) available on MAIL's localhost, port 4002.

[root@mail ~]# ps xuaw | grep autossh
user    1140  0.0  0.0   6512   328 ?        Ss   Oct04   0:00 autossh -M 0 -q    -N -o ServerAliveInterval 60 -o ServerAliveCountMax 3 -L 4002:127.0.0.1:3306 tunnel@159.69.42.158
root      3662  0.0  0.0 112704   976 pts/0    S+   07:22   0:00 grep --color=auto autossh

I have already created admin_iredmail on DB and I can connect from MAIL using the tunnel.

[root@mail ~]# mysql -h 127.0.0.1 -P 4002 -u admin_iredmail -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 372
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

I believe the problem is simply the fact that the installer is trying to use "localhost" instead of "127.0.0.1" - and therefore is using socket instead of TCP.

Maybe there is an option to pass "--protocol=TCP" to the MySQL commands in your script - I would rather not change it mysqlf?

3

Re: Force iRedMail to install (and use) a TCP connection with MySQL

Nevermind. I gave up on this as well...