Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix' failed

  1. #1
    Join Date
    Oct 2011
    Location
    Poland
    Posts
    8

    Question OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix' failed

    Hey,, please help me.

    I`d like to run Zabbix but I can not start zabbix-server, because [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql' (13).

    I installed mysql server, apache2 and zabbix from packages. I change password of mysql`s root and it works ok. I created database zabbix as root. root has all privilages of zabbix database. I imported data.sql and etc into database zabbix as root.

    Belowe my configuration:

    Code:
    111015 18:29:59 mysqld_safe mysqld from pid file /var/run/mysql/mysqld.pid ended                                                                                                                           
    111015 18:29:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    111015 18:29:59 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
    111015 18:29:59  InnoDB: Started; log sequence number 0 7264817
    111015 18:30:00 [Note] Event Scheduler: Loaded 0 events
    111015 18:30:00 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.53-log'  socket: '/var/run/mysql/mysql.sock'  port: 3306  SUSE MySQL RPM
    Code:
    linux-1o35:~ # lsof | grep mysql.sock
    mysqld    2753           mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2755      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2756      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2757      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2758      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2761      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2762      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2763      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2764      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    mysqld    2753 2765      mysql   13u     unix 0xddab0280      0t0       7914 /var/run/mysql/mysql.sock
    linux-1o35:~ #
    Code:
    inux-1o35:~ # ps aux | grep mysqld
    root      2633  0.0  0.2   3060  1288 pts/0    S    18:29   0:00 /bin/sh /usr/bin/mysqld_safe --mysqld=mysqld --user=mysql --pid-file=/var/run/mysql/mysqld.pid --socket=/var/run/mysql/mysql.sock --datadir=/var/lib/mysql
    mysql     2753  0.1  5.0 124840 25088 pts/0    Sl   18:29   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysql/mysqld.log --pid-file=/var/run/mysql/mysqld.pid --socket=/var/run/mysql/mysql.sock --port=3306
    root      2842  0.0  0.1   2500   508 pts/0    S+   18:35   0:00 grep mysqld
    linux-1o35:~ #
    Code:
    linux-1o35:~ # cat /usr/share/zabbix/conf/zabbix.conf.php
    <?php
    // Zabbix GUI configuration file
    global $DB;
    
    $DB["TYPE"]                             = 'MYSQL';
    $DB["SERVER"]                   = 'localhost';
    $DB["PORT"]                             = '0';
    $DB["DATABASE"]                 = 'zabbix';
    $DB["USER"]                             = 'root';
    $DB["PASSWORD"]                 = 'pass123';
    // SCHEMA is relevant only for IBM_DB2 database
    $DB["SCHEMA"]                   = '';
    
    $ZBX_SERVER                             = 'localhost';
    $ZBX_SERVER_PORT                = '10051';
    $ZBX_SERVER_NAME                = '';
    
    $IMAGE_FORMAT_DEFAULT   = IMAGE_FORMAT_PNG;
    ?>
    Code:
    my.cnf :
    
    [client]
    port            = 3306
    socket          = /var/run/mysql/mysql.sock
    [mysqld]
    port            = 3306
    socket          = /var/run/mysql/mysql.sock
    datadir = /var/lib/mysql
    skip-locking
    key_buffer_size = 16M
    max_allowed_packet = 1M
    table_open_cache = 64
    sort_buffer_size = 512K
    net_buffer_length = 8K
    read_buffer_size = 256K
    read_rnd_buffer_size = 512K
    myisam_sort_buffer_size = 8M
    
    log-bin=mysql-bin
    
    binlog_format=mixed
    
    server-id       = 1
    log-error       = /var/log/mysql/mysqld.log
    socket          = /var/run/mysql/mysql.sock
    
    !include_dir /etc/mysql
    
    [mysqldump]
    socket          = /var/run/mysql/mysql.sock
    quick
    max_allowed_packet = 16M
    
    [mysql]
    no-auto-rehash
    
    [myisamchk]
    key_buffer_size = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    
    [mysqld_multi]
    mysqld     = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
    log        = /var/log/mysqld_multi.log
    I also tried :
    Code:
    ln -s /var/run/mysql/mysql.sock /var/lib/mysql/mysql.sock
    But still I have :

    Code:
    2884:20111015:183654.644 Starting Zabbix Server. Zabbix 1.8.8 (revision 21965).
      2884:20111015:183654.644 ****** Enabled features ******
      2884:20111015:183654.644 SNMP monitoring:           YES
      2884:20111015:183654.644 IPMI monitoring:           YES
      2884:20111015:183654.644 WEB monitoring:            YES
      2884:20111015:183654.644 Jabber notifications:      YES
      2884:20111015:183654.644 Ez Texting notifications:  YES
      2884:20111015:183654.644 ODBC:                       NO
      2884:20111015:183654.645 SSH2 support:              YES
      2884:20111015:183654.645 IPv6 support:              YES
      2884:20111015:183654.645 ******************************
      2884:20111015:183654.648 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql' (13)
      2884:20111015:183654.648 Cannot connect to the database. Exiting...
    linux-1o35:~ #
    I can login into zabbix www panel. Also I added additional user to manage zabbix and user is in database zabbix in users. But still I see Zabbix server is running with Value: No.

    Please give any suggestion.

    Regards,
    BB
    Last edited by barrnabba; 15-Oct-2011 at 10:44. Reason: more information

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    On 10/15/2011 07:46 PM, barrnabba wrote:
    > I created database zabbix as
    > root. root has all privilages of zabbix database. I imported data.sql
    > and etc into database zabbix as root.


    is that the way it is supposed to be done?

    i ask, because i've never used Zabbix (in fact never heard of it) but i see:

    3.2.1.2 User account

    For all of the Zabbix daemon processes, an unprivileged user is
    required. If the daemon is started from an unprivileged user account, it
    runs as that user. If the daemon is started from a root account, it
    changes to user account “zabbix”, which must be present.

    Separate user account is not required for Zabbix frontend installation.

    To create such a user account (in it's own group, “zabbix”) on Linux
    systems:

    groupadd zabbix
    useradd -g zabbix zabbix

    Running Zabbix as root, bin, or any other account with special rights is
    a security risk.
    cite:
    http://www.zabbix.com/documentation/...lation/install

    --
    DD
    http://www.youtube.com/watch?v=wDlM47j0Ae8
    http://tinyurl.com/DD-Caveat
    http://tinyurl.com/DD-Hardware
    http://tinyurl.com/DD-Software
    openSUSE®, the "German Automobiles" of operating systems

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    On 2011-10-15 19:46, barrnabba wrote:
    > I`d like to run Zabbix but I can not start zabbix-server, because
    > [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to
    > local MySQL server through socket '/var/lib/mysql' (13).


    That's not where SUSE puts the socket. Verify its placement in mysql config
    file, then change the zabbix server to look at the correct place.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  4. #4
    Join Date
    Oct 2011
    Location
    Poland
    Posts
    8

    Unhappy Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix' failed

    Thank you for your replay. In my.cnf I changed path to all sockets but still the same

    Code:
    linux-4mak:~ # cat /etc/my.cnf 
    
    # The following options will be passed to all MySQL clients
    [client]
    #password	= your_password
    port		= 3306
    socket		= /var/lib/mysql/mysql.sock
    
    # The MySQL server
    [mysqld]
    port		= 3306
    socket		= /var/lib/mysql/mysql.sock
    # Change following line if you want to store your database elsewhere
    datadir	= /var/lib/mysql
    skip-locking
    key_buffer_size = 16M
    max_allowed_packet = 1M
    table_open_cache = 64
    sort_buffer_size = 512K
    net_buffer_length = 8K
    read_buffer_size = 256K
    read_rnd_buffer_size = 512K
    myisam_sort_buffer_size = 8M
    
    # binary logging is required for replication
    log-bin=mysql-bin
    
    # binary logging format - mixed recommended
    binlog_format=mixed
    
    # but will not function as a master if omitted
    server-id	= 1
    
    # The safe_mysqld script
    [safe_mysqld]
    log-error	= /var/log/mysql/mysqld.log
    socket		= /var/lib/mysql/mysql.sock
    
    !include_dir /etc/mysql
    
    [mysqldump]
    socket		= /var/lib/mysql/mysql.sock
    quick
    max_allowed_packet = 16M
    
    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    [myisamchk]
    key_buffer_size = 20M
    sort_buffer_size = 20M
    read_buffer = 2M
    write_buffer = 2M
    
    [mysqlhotcopy]
    interactive-timeout
    
    [mysqld_multi]
    mysqld     = /usr/bin/mysqld_safe
    mysqladmin = /usr/bin/mysqladmin
    log        = /var/log/mysqld_multi.log
    # If you want to use mysqld_multi uncomment 1 or more mysqld sections
    
    linux-4mak:~ #
    Also I change permissions:

    Code:
    linux-4mak:/ # ll /var/run/zabbix/zabbix-server.pid 
    -rwxrwxrwx 1 zabbix zabbix 4 Oct 16 02:19 /var/run/zabbix/zabbix-server.pid
    Code:
    linux-4mak:/ # ll /var/log/zabbix/zabbix-server.log 
    -rwxr-xr-x 1 zabbix zabbix 14192 Oct 16 02:27 /var/log/zabbix/zabbix-server.log
    Code:
    linux-4mak:/ # ll /etc/zabbix/zabbix-server.conf 
    -rwxrwxr-x 1 zabbix root 8995 Oct 16 01:58 /etc/zabbix/zabbix-server.conf

    And nothing,

    Code:
    3039:20111016:023848.521 Starting Zabbix Server. Zabbix 1.8.8 (revision 21965).
      3039:20111016:023848.521 ****** Enabled features ******
      3039:20111016:023848.521 SNMP monitoring:           YES
      3039:20111016:023848.521 IPMI monitoring:           YES
      3039:20111016:023848.521 WEB monitoring:            YES
      3039:20111016:023848.521 Jabber notifications:      YES
      3039:20111016:023848.521 Ez Texting notifications:  YES
      3039:20111016:023848.521 ODBC:                       NO
      3039:20111016:023848.521 SSH2 support:              YES
      3039:20111016:023848.521 IPv6 support:              YES
      3039:20111016:023848.522 ******************************
      3039:20111016:023848.527 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql' (13)
      3039:20111016:023848.527 Cannot connect to the database. Exiting...
    linux-4mak:/ #
    Regards
    ..

  5. #5
    Join Date
    Oct 2011
    Location
    Poland
    Posts
    8

    Question Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix' failed

    I came back to default my.cnf but I changed DBSocket in zabbix-server.conf into DBSocket=/var/run/mysql

    Code:
    linux-4mak:/usr/share/zabbix # cat /etc/zabbix/zabbix-server.conf 
    LogFile=/var/log/zabbix/zabbix-server.log
    PidFile=/var/run/zabbix/zabbix-server.pid
    DBName=zabbix
    DBUser=zabbix
    DBPassword=mycorrectpasswd
    DBSocket=/var/run/mysql
    
    linux-4mak:/usr/share/zabbix #
    and still nothing, what`s wrong. . . . .

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    On 2011-10-16 00:46, barrnabba wrote:
    >
    > Thank you for your replay. In my.cnf I changed path to all sockets but
    > still the same


    You have to change zabbix, not mysql.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    On 2011-10-16 01:06, barrnabba wrote:
    >
    > I came back to default my.cnf but I changed DBSocket in
    > zabbix-server.conf into DBSocket=/var/run/mysql


    The default mysql socket is /var/run/mysql/mysql.sock, and that is not what
    zabbix says.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  8. #8
    Join Date
    Oct 2011
    Location
    Poland
    Posts
    8

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    Carlos,

    thanks for your help.

    I changed DBSocket on /va/run/mysql and I saw:

    Code:
    3851:20111016:034335.492 Starting Zabbix Server. Zabbix 1.8.8 (revision 21965).
      3851:20111016:034335.492 ****** Enabled features ******
      3851:20111016:034335.492 SNMP monitoring:           YES
      3851:20111016:034335.492 IPMI monitoring:           YES
      3851:20111016:034335.492 WEB monitoring:            YES
      3851:20111016:034335.492 Jabber notifications:      YES
      3851:20111016:034335.492 Ez Texting notifications:  YES
      3851:20111016:034335.492 ODBC:                       NO
      3851:20111016:034335.492 SSH2 support:              YES
      3851:20111016:034335.492 IPv6 support:              YES
      3851:20111016:034335.492 ******************************
      3851:20111016:034335.496 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysql' (13)
      3851:20111016:034335.496 Cannot connect to the database. Exiting...
    So what do you suggest ? What to change in Zabbix ?

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    On 2011-10-16 01:56, barrnabba wrote:

    > So what do you suggest ? What to change in Zabbix ?


    I told you that you have to tell zabbix to use the same socket as defined
    in my.cfg, which is '/var/run/mysql/mysql.sock', not '/var/run/mysql'

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  10. #10
    Join Date
    Oct 2011
    Location
    Poland
    Posts
    8

    Default [SOLVED] Re: OpenSuse 11.4, Zabbix 1.8.8 and connection to database 'zabbix'failed

    in zabbix-server.conf I changed :

    Code:
    linux-4mak:/usr/share/zabbix # cat /etc/zabbix/zabbix-server.conf
    LogFile=/var/log/zabbix/zabbix-server.log
    PidFile=/var/run/zabbix/zabbix-server.pid
    DBName=zabbix
    DBUser=zabbix
    DBPassword=mycorrectpassword
    DBSocket=/var/run/mysql/mysql.sock
    and . . . . dadammmm it works:

    Code:
    linux-4mak:/usr/share/zabbix # ps uax | grep zabbix
    root      2562  0.0  0.0   2216   484 tty2     S+   02:11   0:00 tail -f /var/log/zabbix/zabbix-server.log
    zabbix    4415  0.0  0.0  48248  2160 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4417  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4418  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4419  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4421  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4422  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4424  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4425  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4426  0.0  0.0  48896  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4427  0.0  0.0  48288  1512 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4428  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4429  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4430  0.0  0.0  48248  1240 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4431  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4432  0.0  0.0  48824  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4433  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4434  0.5  0.0  48312  1512 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4435  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4436  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4437  0.0  0.0  48636  2396 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4438  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4439  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4440  0.0  0.0  48248  1248 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4441  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4442  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4443  0.0  0.0  48248  1244 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4444  0.0  0.0  48248  1024 ?        SN   04:05   0:00 /usr/sbin/zabbix-server
    zabbix    4515  0.0  0.0   5444   700 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    zabbix    4516  0.0  0.0   5444   848 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    zabbix    4517  0.0  0.0   5444   452 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    zabbix    4518  0.0  0.0   5444   452 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    zabbix    4519  0.0  0.0   5444   452 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    zabbix    4520  0.0  0.0   5444   692 ?        SN   04:08   0:00 /usr/sbin/zabbix-agentd
    root      4522  0.0  0.0   3684   768 pts/0    S+   04:08   0:00 grep zabbix
    Thank you, thank you very much, for help.

    Special thanks for Carlos, you rock !!!.

    Regards,
    BB

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •