Ad Widget

Collapse

Database error - mysql not running

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Inxmatba
    Junior Member
    • Feb 2017
    • 9

    #1

    Database error - mysql not running

    Hello

    I try to upgrade Zabbix from 3.2.7 to 4.4 and use the path given by https://www.zabbix.com/documentation.../debian_ubuntu
    When I finished all the steps, I tried to access zabbix via browser and got the following error message:

    Click image for larger version

Name:	Schnappschuss_021820_105117_AM.jpg
Views:	12868
Size:	17.4 KB
ID:	395806

    I recognized that the mysql service is not running
    # service --status-all
    [ - ] mysql

    So i tried to start mysql
    # /etc/init.d/mysql start.

    But it isn't starting without an error message or error logs.


    kind regards
    lnxmatba
  • osamazx
    Junior Member
    • Jan 2020
    • 15

    #2
    If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with
    socket=/var/lib/mysql/mysql.sock

    you can check if mysql is running with the following command:
    mysqladmin -u root -p status and post it here again

    Comment

    • Inxmatba
      Junior Member
      • Feb 2017
      • 9

      #3
      Originally posted by osamazx
      If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with
      socket=/var/lib/mysql/mysql.sock

      you can check if mysql is running with the following command:
      mysqladmin -u root -p status and post it here again
      /etc/mysql/my.cnf
      # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
      [client]
      port = 3306
      socket = /var/run/mysqld/mysqld.sock

      # Here is entries for some specific programs
      # The following values assume you have at least 32M ram

      # This was formally known as [safe_mysqld]. Both versions are currently parsed.
      [mysqld_safe]
      socket = /var/run/mysqld/mysqld.sock
      nice = 0






      # mysqladmin -u root -p status
      Enter password:
      mysqladmin: connect to server at 'localhost' failed
      error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
      Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

      Last edited by Inxmatba; 18-02-2020, 14:11.

      Comment

      • osamazx
        Junior Member
        • Jan 2020
        • 15

        #4
        Originally posted by Inxmatba
        /etc/mysql/my.cnf
        Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists![/INDENT]
        did you check if the file is exists ?

        Comment

        • Inxmatba
          Junior Member
          • Feb 2017
          • 9

          #5
          Originally posted by osamazx

          did you check if the file is exists ?
          Yes I did, as you can see in my post above. The file exists and the socket is defined.

          Comment

          • osamazx
            Junior Member
            • Jan 2020
            • 15

            #6
            there are 3 things to do in that case :-
            1- restart the services
            sudo systemctl stop mysql.service
            sudo systemctl start mysql.service

            2- Check The Socket Path --> which we already done
            3- Check Data Directory Permissions
            sudo chmod -R 755 /var/lib/mysql/

            Comment

            • Inxmatba
              Junior Member
              • Feb 2017
              • 9

              #7
              Service restart result:
              root@xxxx:/etc/mysql# systemctl stop mysql.service
              root@xxxx:/etc/mysql# systemctl start mysql.service
              root@xxxx:/etc/mysql# systemctl status mysql.service
              ● mysql.service - LSB: Start and stop the mysql database server daemon
              Loaded: loaded (/etc/init.d/mysql; generated)
              Active: active (exited) since Tue 2020-02-18 15:49:41 CET; 14s ago
              Docs: man:systemd-sysv-generator(8)
              Process: 24318 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)

              Feb 18 15:49:41 xxxx systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
              Feb 18 15:49:41 xxxx systemd[1]: Started LSB: Start and stop the mysql database server daemon.


              Permissions before:
              root@xxxx:/var/lib/mysql# ls -la
              total 24145952
              drwxr-xr-x 5 mysql mysql 4096 Feb 13 09:08 .
              drwxr-xr-x 66 root root 4096 Feb 13 13:21 ..
              -rwxr-xr-x 1 mysql mysql 0 Apr 26 2017 debian-5.5.flag
              -rwxr-xr-x 1 mysql mysql 24714936320 Feb 13 11:54 ibdata1
              -rwxr-xr-x 1 mysql mysql 5242880 Feb 13 11:54 ib_logfile0
              -rwxr-xr-x 1 mysql mysql 5242880 Feb 13 09:19 ib_logfile1
              drwxr-xr-x 2 mysql mysql 4096 Apr 26 2017 mysql
              -rwxr-xr-x 1 mysql mysql 6 Apr 26 2017 mysql_upgrade_info
              drwxr-xr-x 2 mysql mysql 4096 Apr 26 2017 performance_schema
              drwxr-xr-x 2 mysql mysql 4096 Feb 28 2017 zabbix

              Permissions after:
              root@xxxx:/var/lib/mysql# chmod -R 755 /var/lib/mysql/
              root@xxxx:/var/lib/mysql# ls -la
              total 24145952
              drwxr-xr-x 5 mysql mysql 4096 Feb 13 09:08 .
              drwxr-xr-x 66 root root 4096 Feb 13 13:21 ..
              -rwxr-xr-x 1 mysql mysql 0 Apr 26 2017 debian-5.5.flag
              -rwxr-xr-x 1 mysql mysql 24714936320 Feb 13 11:54 ibdata1
              -rwxr-xr-x 1 mysql mysql 5242880 Feb 13 11:54 ib_logfile0
              -rwxr-xr-x 1 mysql mysql 5242880 Feb 13 09:19 ib_logfile1
              drwxr-xr-x 2 mysql mysql 4096 Apr 26 2017 mysql
              -rwxr-xr-x 1 mysql mysql 6 Apr 26 2017 mysql_upgrade_info
              drwxr-xr-x 2 mysql mysql 4096 Apr 26 2017 performance_schema
              drwxr-xr-x 2 mysql mysql 4096 Feb 28 2017 zabbix


              The error still exists.

              Comment

              • reinaldovp
                Junior Member
                • Dec 2019
                • 5

                #8
                Hi, I had the same problem and it was a table corrupted in zabbix database.
                You have to try start the mysql with
                innodb_force_recovery > 2 in the /etc/mysql/my.cnf and then backup, drop tables and recover. In my case was the history_uint table I followed this link http://blackbird.si/mysql-corrupted-...by-step-guide/

                Comment

                Working...