Installation complete, rc.piler: can't connect to mysql server

Issue #843 closed
Stefan Scholz created an issue

Hello Janos, after your hint by mail concerning the compiling (make clean all did the trick) piler can't connect to mysql. I read #840. piler.conf was created with zero bytes. I copied the ... .dist and changed the mysql password:

mysql_connect_timeout=2 mysqldb=piler mysqlpwd=** mysqlsocket=/var/run/mysqld/mysqld.sock mysqluser=piler

I suspect the Socket to be the problem, as a manual connection to mysql using piler/piler/pwd is working fine. The DB is created. Testing this I added the mysql und www-data usergroups to the piler user... without success.

rd.searchd is also not starting... I will post in a different issue..

Many thanks for your help Stefan

Comments (15)

  1. Janos SUTO repo owner

    Well, mysql creates and uses /var/run/mysqld/mysqld.sock on debian/ubuntu. If you have a different distro, then it can be a different value.

    "Testing this I added the mysql und www-data usergroups to the piler user... without success."

    No, this is not a good idea, I'd suggest to revert it.

    Also run pilerconf, and verify that it can see the proper mysql parameters. If not, then fix it in piler.conf.

  2. Stefan Scholz reporter

    Hello Janos, I reverted the usergroup issue. The mysqld.sock is at the right place and can be found. Starting piler still results in "cant connect to mysql server". pilerconf results in: archive_emails_not_having_message_id=0 archive_only_mydomains=0 backlog=20 cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS clamd_addr= clamd_port=0 clamd_socket=/tmp/clamd debug=0 default_retention_days=2920 enable_chunking=0 enable_cjk=0 enable_folders=0 encrypt_messages=1 extra_to_field=X-Envelope-To: extract_attachments=1 helper_timeout=20 hostid=piler.fritz.box iv= listen_addr=0.0.0.0 listen_port=25 locale= max_requests_per_child=1000 memcached_servers=127.0.0.1 memcached_to_db_interval=900 memcached_ttl=86400 min_message_size=100 min_word_len=1 mmap_dedup_test=0 mysqlhost= mysqlport=0 mysqlsocket=/var/run/mysqld/mysqld.sock mysqluser=piler mysqlpwd=* mysqldb=piler mysql_connect_timeout=2 number_of_worker_processes=10 pemfile=/usr/local/etc/piler/piler.pem pidfile=/srv/piler/run/piler/piler.pid piler_header_field=X-piler-id: process_rcpt_to_addresses=0 queuedir=/srv/piler/piler/store server_id=0 spam_header_line= syslog_recipients=0 tls_enable=0 tweak_sent_time_offset=0 update_counters_to_memcached=0 username=piler use_antivirus=1 verbosity=1 workdir=/srv/piler/piler/tmp

  3. Janos SUTO repo owner

    I an't read this, it's torturing my eyes. Please use the formatting options of bitbucket.

  4. Stefan Scholz reporter

    I'm sorry. This development stuff is quite new to me. I'm more user than administrator with very basic unix knowhow.

    so the output of "pilerconf" is:

    archive_emails_not_having_message_id=0
    archive_only_mydomains=0
    backlog=20
    cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
    clamd_addr=
    clamd_port=0
    clamd_socket=/tmp/clamd
    debug=0
    default_retention_days=2920
    enable_chunking=0
    enable_cjk=0
    enable_folders=0
    encrypt_messages=1
    extra_to_field=X-Envelope-To:
    extract_attachments=1
    helper_timeout=20
    hostid=piler.fritz.box 
    iv=
    listen_addr=0.0.0.0
    listen_port=25
    locale=
    max_requests_per_child=1000
    memcached_servers=127.0.0.1
    memcached_to_db_interval=900
    memcached_ttl=86400
    min_message_size=100
    min_word_len=1
    mmap_dedup_test=0
    mysqlhost=
    mysqlport=0
    mysqlsocket=/var/run/mysqld/mysqld.sock
    mysqluser=piler
    mysqlpwd=M4!lPiler 
    mysqldb=piler
    mysql_connect_timeout=2
    number_of_worker_processes=10
    pemfile=/usr/local/etc/piler/piler.pem
    pidfile=/srv/piler/run/piler/piler.pid
    piler_header_field=X-piler-id:
    process_rcpt_to_addresses=0
    queuedir=/srv/piler/piler/store
    server_id=0
    spam_header_line=
    syslog_recipients=0
    tls_enable=0
    tweak_sent_time_offset=0
    update_counters_to_memcached=0
    username=piler
    use_antivirus=1
    verbosity=1
    workdir=/srv/piler/piler/tmp
    

    Does this help why the connection to mysql cannot be established? The manual connection does work:

    root@serverlein:/srv/mailpiler# mysql piler -u piler -p
    Enter password: 
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 22126
    Server version: 5.5.54-0ubuntu0.12.04.1 (Ubuntu)
    
    Copyright (c) 2000, 2016, 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> 
    
  5. Janos SUTO repo owner

    Thanks for formatting! Please show me ls -l /var/run/mysqld/mysqld.sock output as well.

  6. Stefan Scholz reporter
    -rw-rw---- 1 mysql mysql 5 Sep 17 12:30 mysqld.pid
    srwxrwxrwx 1 mysql mysql 0 Sep 17 12:30 mysqld.sock
    
  7. Janos SUTO repo owner

    Thanks. Try to remove the mysqlhost and mysqlport parameters from /usr/local/etc/piler/piler.conf file, then restart the piler daemon.

  8. Stefan Scholz reporter

    these parameters are not in the piler.conf. I restarted the machine. Unfortunately with the same result as before:

    root@serverlein:/etc/init.d# ./rc.piler start
    starting piler . . .
    cant connect to mysql server
    root@serverlein:/etc/init.d# 
    
  9. shahul

    Hi Janos.,

    when start the piler i got the error, kindly advise

    " /etc/init.d/rc.piler start /etc/init.d/rc.piler: 1: test: error: unexpected operator starting piler . . . error parsing the configfile: /usr/local/etc/piler/piler.conf cant connect to mysql server"

    Thanks in advance.

  10. Janos SUTO repo owner

    Make sure you have /usr/local/etc/piler/piler.conf. If not, the copy /usr/local/etc/piler/piler.conf.dist to /usr/local/etc/piler/piler.conf and adjust the mysql password (double check if the mysql socket is defined properly).

  11. Log in to comment