MYSQL connection faile: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock'

EXIM, sendmail, postfix, Dovecot и прочие. Решение проблем связанных с работой электронной почты

Модератор: xM

Правила форума
Убедительная просьба юзать теги [code] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
kdvteach
проходил мимо
Сообщения: 2
Зарегистрирован: 2016-01-09 9:17:21

MYSQL connection faile: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock'

Непрочитанное сообщение kdvteach » 2016-01-09 10:13:19

День добрый!
Моя задача обновить Slackware 12.0 -> 14.0 c exim4.69 courier mysql
Сейчас Slackware 14.0 exim4.69 courier-imap 4.6.0 mysql 5.5.27 ранее на старом работающем mysql 5.1
использую старую БД exim, переносил как дампом так и файлами..
my.cnf пробовал как старый так и сконфигурированный новый.
Exim не может соединится с Mysql, вот лог файлы:
exim log
  • Код: Выделить всё

    2016-01-09 16:03:07 exim 4.69 daemon started: pid=2755, -q15m, listening for SMTP on port 25 (IPv4)
    2016-01-09 16:08:08 no host name found for IP address 
    2016-01-09 16:08:08 failed to expand "${lookup mysql{SELECT domainname FROM domains WHERE domainname='${domain}' AND (type='LOCAL' OR type='VIRTUAL')}}" while checking a list: lookup of "SELECT domainname FROM domains WHERE domainname='' AND (type='LOCAL' OR type='VIRTUAL')" gave DEFER: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
    2016-01-09 16:08:08 H=() [] sender verify defer for <>: domains check lookup or other defer
    2016-01-09 16:08:08 H=() [] F=<> temporarily rejected RCPT <>: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
    2016-01-09 16:20:02 no host name found for IP address 
    2016-01-09 16:20:02 auth_login authenticator failed for (User) [185.130.5.240]: 435 Unable to authenticate at present (set_id=net@): lookup of "SELECT id FROM users WHERE id = 'net@' AND passwd = 'net' AND active = 'Y'" gave DEFER: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
mysql log
  • Код: Выделить всё

    160109 16:02:14 mysqld_safe mysqld from pid file /var/lib/mysql/router.pid ended
    160109 16:03:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    160109 16:03:07 [Warning] The syntax '--log' is deprecated and will be removed in a future release. Please use '--general-log'/'--general-log-file' instead.
    160109 16:03:07 [Note] Plugin 'FEDERATED' is disabled.
    160109 16:03:07 InnoDB: The InnoDB memory heap is disabled
    160109 16:03:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    160109 16:03:07 InnoDB: Compressed tables use zlib 1.2.6
    160109 16:03:07 InnoDB: Using Linux native AIO
    160109 16:03:07 InnoDB: Initializing buffer pool, size = 128.0M
    160109 16:03:07 InnoDB: Completed initialization of buffer pool
    160109 16:03:07 InnoDB: highest supported file format is Barracuda.
    160109 16:03:07  InnoDB: Waiting for the background threads to start
    160109 16:03:08 InnoDB: 1.1.8 started; log sequence number 1595685
    160109 16:03:09 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
    160109 16:03:09 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
    160109 16:03:09 [Note] Server socket created on IP: '127.0.0.1'.
    160109 16:03:09 [Note] Event Scheduler: Loaded 0 events
    160109 16:03:09 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.5.27-log'  socket: '/var/run/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
mysql log
  • Код: Выделить всё

    /usr/libexec/mysqld, Version: 5.5.27-log (MySQL Community Server (GPL)). started with:
    Tcp port: 3306  Unix socket: /var/run/mysql/mysql.sock
    Time                 Id Command    Argument
    160109 16:09:55	    1 Connect	root@localhost on 
    		    1 Query	select @@version_comment limit 1
    160109 16:09:57	    1 Quit
Протокол обмена
  • Код: Выделить всё

    Exim version 4.69 uid=0 gid=0 pid=2716 D=10000
    Berkeley DB: Berkeley DB 4.8.30: (April  9, 2010)
    Support for: crypteq iconv() Perl OpenSSL move_frozen_messages
    Lookups: lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz mysql
    Authenticators: cram_md5 cyrus_sasl plaintext
    Routers: accept dnslookup ipliteral manualroute queryprogram redirect
    Transports: appendfile/maildir autoreply lmtp pipe smtp
    Fixed never_users: 0
    Size of off_t: 8
    configuration file is /etc/mail/exim.conf
    log selectors = 0000cefe 00233801
    cwd=/var/spool/mqueue/log 3 args: exim -d-all+lookup -bd
    trusted user
    admin user
     2716 listening on all interfaces (IPv4) port 25
     2716 pid written to /var/spool/mqueue/exim-daemon.pid
     2716 LOG: MAIN
     2716   exim 4.69 daemon started: pid=2716, no queue runs, listening for SMTP on port 25 (IPv4)
     2716 daemon running with uid=8 gid=12 euid=8 egid=12
     2716 Listening...
     2716 Connection request from  port 56317
     2716 search_tidyup called
     2716 1 SMTP accept process running
     2716 Listening...
     2720 Process 2720 is handling incoming connection from []
     2720 LOG: host_lookup_failed MAIN
     2720   no host name found for IP address 
     2720 Process 2720 is ready for new message
     2720 search_open: mysql "NULL"
     2720 search_find: file="NULL"
     2720   key="SELECT domainname FROM domains WHERE domainname=' AND (type='LOCAL' OR type='VIRTUAL')" partial=-1 affix=NULL starflags=0
     2720 LRU list:
     2720 internal_search_find: file="NULL"
     2720   type=mysql key="SELECT domainname FROM domains WHERE domainname='' AND (type='LOCAL' OR type='VIRTUAL')"
     2720 database lookup required for SELECT domainname FROM domains WHERE domainname='' AND (type='LOCAL' OR type='VIRTUAL')
     2720 MySQL query: SELECT domainname FROM domains WHERE domainname='' AND (type='LOCAL' OR type='VIRTUAL')
     2720 MYSQL new connection: host=localhost port=0 socket=NULL database=exim user=exim
     2720 MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
     2720 lookup deferred: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
     2720 LOG: MAIN PANIC
     2720   failed to expand "${lookup mysql{SELECT domainname FROM domains WHERE domainname='${domain}' AND (type='LOCAL' OR type='VIRTUAL')}}" while checking a list: lookup of "SELECT domainname FROM domains WHERE domainname='' AND (type='LOCAL' OR type='VIRTUAL')" gave DEFER: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
     2720 LOG: MAIN REJECT
     2720   H=(validation.sls.microsoft.com) [1] sender verify defer for <>: domains check lookup or other defer
     2720 LOG: MAIN REJECT
     2720   H=(validation.sls.microsoft.com) [] F=<> temporarily rejected RCPT <>: MYSQL connection failed: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13)
     2720 LOG: smtp_connection MAIN
     2720   SMTP connection from (validation.sls.microsoft.com) [] closed by QUIT
     2720 search_tidyup called
     2716 child 2720 ended: status=0x0
     2716 0 SMTP accept processes now running
     2716 Listening...
Процесс exim
  • Код: Выделить всё

    exim -bV
    Exim version 4.69 #1 built 07-Jan-2016 13:50:39
    Copyright (c) University of Cambridge 2006
    Berkeley DB: Berkeley DB 4.8.30: (April  9, 2010)
    Support for: crypteq iconv() Perl OpenSSL move_frozen_messages
    Lookups: lsearch wildlsearch nwildlsearch iplsearch dbm dbmnz mysql
    Authenticators: cram_md5 cyrus_sasl plaintext
    Routers: accept dnslookup ipliteral manualroute queryprogram redirect
    Transports: appendfile/maildir autoreply lmtp pipe smtp
    Fixed never_users: 0
    Size of off_t: 8
    Configuration file is /etc/mail/exim.conf
  • Код: Выделить всё

    netstat -lnp | grep mysql
    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      2748/mysqld
    unix  2      [ ACC ]     STREAM     LISTENING     7075     2748/mysqld          /var/run/mysql/mysql.sock
  • Код: Выделить всё

    ps ax | grep mysql
     2394 ?        S      0:00 /bin/sh /usr/bin/mysqld_safe --user=root
     2748 ?        Sl     0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=root --log-error=/var/lib/mysql/router.err --pid-file=/var/lib/mysql/router.pid --socket=/var/run/mysql/mysql.sock --port=3306
     2984 pts/0    S+     0:00 grep mysql
Может быть причина в не совместимости exim4.69 c mysql 5.5.27?
Спасибо.

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

kdvteach
проходил мимо
Сообщения: 2
Зарегистрирован: 2016-01-09 9:17:21

MYSQL connection faile: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock'

Непрочитанное сообщение kdvteach » 2016-01-10 4:01:17

Решение:
Проверка соединения
mysql -h 127.0.0.1 -P 3306 -u exim -p
Закончилось ошибкой.
Создал пользователя в mysql:
CREATE USER 'exim'@'%' IDENTIFIED BY 'pass';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON exim.* TO 'exim'@'%';
Изменил exim.conf строку:
с hide mysql_servers = localhost/exim...
на hide mysql_servers = 127.0.0.1/exim...
Хотя пользователь exim c localhost имелся.
Ну и заработало, всем спасибо, бог в помощь, а без мозгов ни куда...