Unable to connect to mysql master server from install.php, but i can from shell

Discussion in 'Installation/Configuration' started by rob_morin, May 5, 2015.

  1. rob_morin

    rob_morin Member

    Hello all...

    I am adding a secondary dns server to an existing multi server setup. when i run the install.php script on this new secondary dns server it always says cannot connect to master mysql server??

    I can connect fine from the shell with mysql -uuser -pPassword -h hostname or ip
    but when entering the same credentials when the script is running gives me the below...

    Shall this server join an existing ISPConfig multiserver setup (y,n) [n]: y

    MySQL master server hostname []: xxx.xxx.xxx.xxx

    MySQL master server root username [root]: root

    MySQL master server root password []: password

    MySQL master server database name [dbispconfig]:

    Unable to connect to mysql server
    MySQL master server hostname []:

    Any ideas to check? server name is in /etc/hosts of secondary(new server)
     
  2. rob_morin

    rob_morin Member

    if it helps here is an strace o finstall.php
    I replace the IPs with xxx.xxx.xxx.xxx

    munmap(0x7f7d951ac000, 4096) = 0
    getcwd("/tmp/ispconfig3_install/install", 4096) = 32
    lstat("/tmp/ispconfig3_install/install/./lib/mysql.lib.php", {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    lstat("/tmp/ispconfig3_install/install/lib/mysql.lib.php", {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    open("/tmp/ispconfig3_install/install/lib/mysql.lib.php", O_RDONLY) = 4
    fstat(4, {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    fstat(4, {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    fstat(4, {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    fstat(4, {st_mode=S_IFREG|0664, st_size=13380, ...}) = 0
    mmap(NULL, 13380, PROT_READ, MAP_SHARED, 4, 0) = 0x7f7d95006000
    munmap(0x7f7d95006000, 13380) = 0
    close(4) = 0
    write(1, "Shall this server join an existi"..., 74) = 74
    read(0, "y\n", 8192) = 2
    write(1, "\n", 1) = 1
    write(1, "MySQL master server hostname []:"..., 33) = 33
    read(0, "web2.domain.com\n", 8192) = 13
    write(1, "\n", 1) = 1
    write(1, "MySQL master server root usernam"..., 42) = 42
    read(0, "\n", 8192) = 1
    write(1, "\n", 1) = 1
    write(1, "MySQL master server root passwor"..., 38) = 38
    read(0, "mysqlPasswordHere\n", 8192) = 14
    write(1, "\n", 1) = 1
    write(1, "MySQL master server database nam"..., 49) = 49
    read(0, "\n", 8192) = 1
    write(1, "\n", 1) = 1
    stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=237, ...}) = 0
    open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 4
    fstat(4, {st_mode=S_IFREG|0644, st_size=386, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7d951ac000
    read(4, "127.0.0.1\tlocalhost\nxxx.xxx.xxx.xxx"..., 4096) = 386
    read(4, "", 4096) = 0
    close(4) = 0
    munmap(0x7f7d951ac000, 4096) = 0
    socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4
    fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
    fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
    connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("xxx.xxx.xxx.xxx")}, 16) = -1 EINPROGRESS (Operation now in progress)
    fcntl(4, F_SETFL, O_RDWR) = 0
    poll([{fd=4, events=POLLIN|POLLPRI}], 1, 60000) = 1 ([{fd=4, revents=POLLIN}])
    getsockopt(4, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
    fcntl(4, F_SETFL, O_RDONLY) = 0
    fcntl(4, F_GETFL) = 0x2 (flags O_RDWR)
    setsockopt(4, SOL_SOCKET, SO_RCVTIMEO, "\2003\341\1\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
    setsockopt(4, SOL_SOCKET, SO_SNDTIMEO, "\2003\341\1\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
    setsockopt(4, SOL_IP, IP_TOS, [8], 4) = 0
    setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0
    setsockopt(4, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
    poll([{fd=4, events=POLLIN}], 1, 60000) = 1 ([{fd=4, revents=POLLIN}])
    read(4, "[\0\0\0\n5.5.43-0ubuntu0.14.04.1\0 \1\0"..., 16384) = 95
    write(4, "P\0\0\1\5\242\16\0\0\0\0@\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 84) = 84
    read(4, "J\0\0\2\377\25\4#28000Access denied for u"..., 16384) = 78
    shutdown(4, SHUT_RDWR) = 0
    close(4) = 0
    write(1, "Unable to connect to mysql serve"..., 35) = 35
    write(1, "MySQL master server hostname []:"..., 33) = 33
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The script asked for the hostname of the master, not the ip:

    MySQL master server hostname []: xxx.xxx.xxx.xxx

    when you enter an ip, then the login must fail.
     
  4. rob_morin

    rob_morin Member

    I actually tried both, and it did not work....
    my master server is web2.domain.com lets say, so i enter that with proper credentials, and it does not work, but from shell its fine... thats whats weird...
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The script does a simple mysql connect trough php, so either the mysql login details are wrong, the hostname is not set correctly or the mysql php version on the slave is incompatible with the mysql version of the master.
     
  6. rob_morin

    rob_morin Member

    But the whole weird thing is that i can connect from the command line(shell) from slave to master with no issues.... I will check into the php version of each server and get back to you...

    Thanks for the quick replies.
     
  7. rob_morin

    rob_morin Member

    So both servers are ..
    mysql Ver 14.14 Distrib 5.5.43, for debian-linux-gnu (x86_64) using readline 6.3
    and
    PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

    Any ideas?
     
  8. fbarcenas

    fbarcenas Member

    I had this problem and my solution was to create an account for root@<every ip on the secondary server> in MYSQL. This is because you can't predict which IP on your secondary server the script will use to contact the primary server.
    So you'll have a MYSQL account on the primary server for:
    root@<primary ip(eth0) on the secondary server>
    root@<virtual ip(eth0:0) on the secondary server>
    root@<virtual ip(eth0:1) on the secondary server>
    etc,etc,etc. Then you will properly authenticate no matter which IP the server chooses to use.
     

Share This Page