Ad Widget

Collapse

Cannot connect to local MySQL server after IP address change

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LCR
    Junior Member
    • May 2019
    • 3

    #1

    Cannot connect to local MySQL server after IP address change

    HI,

    I'm running Zabbix 4.0 with a local mysql db and need to re-ip the server. However, when I change the IP address, I get the following errors in the logs:

    5324:20191104:173147.884 ******************************
    5324:20191104:173147.884 using configuration file: /etc/zabbix/zabbix_server.conf
    5324:20191104:173147.905 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2 "No such file or directory")
    5324:20191104:173147.905 database is down: reconnecting in 10 seconds
    5324:20191104:173157.923 database connection re-established
    5324:20191104:173157.924 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]
    5324:20191104:173157.924 cannot use database "zabbix": database is not a Zabbix database
    6025:20191104:173208.161 Starting Zabbix Server. Zabbix 4.0.4 (revision 89349).


    I have tested the I have the correct DB username, password and permissions, but worryingly it looks like there are no tables associated with the zabbix database anymore:

    MariaDB [(none)]> use zabbix;
    Database changed
    MariaDB [zabbix]> show tables;
    Empty set (0.000 sec)

    MariaDB [zabbix]>

    When I switch the IP address back again, everything works fine again. Can anyone advise please? Is there somewhere else, other than the zabbix_agentd.conf and /etc/hosts files that the new IP address needs to be specified? I have the following set in the zabbix_server.conf file:

    DBHost=localhost

    DBName=zabbix

    DBUser=zabbix

    DBPassword=<redacted>
  • valentins.grins
    Member
    • Nov 2019
    • 38

    #2
    Hello,

    When you run the show tables command you are using "zabbix" user or "root"? If you were using "zabbix" user then please try the same actions with "root" and let us know what are the results.

    Additionally can you please try to login with root user and run following query:

    Code:
    select User, Host, Password from mysql.user;

    Comment

    Working...