Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-4219

Observium Agent MySQL : mysql.cnf don't parse correctly new debian.cnf

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None
    • Professional Edition
    • Default
    • None
    • php8.0

    Description

      Hello,

      On fresh Debian 11 installation, the file /etc/mysql/debian.cnf have new multiline header :

      THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE.
      This file exists only for backwards compatibility for
      tools that run '--defaults-file=/etc/mysql/debian.cnf'
      and have root level access to the local filesystem.
      With those permissions one can run 'mariadb' directly
      anyway thanks to unix socket authentication and hence
      this file is useless. See package README for more info. 

       

      The current preg_replace fail to parse correctly this file :

      var_dump($mysql_ini);
      string(544) "; THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE.
      # This file exists only for backwards compatibility for
      # tools that run '--defaults-file=/etc/mysql/debian.cnf'
      # and have root level access to the local filesystem.
      # With those permissions one can run 'mariadb' directly
      # anyway thanks to unix socket authentication and hence
      # this file is useless. See package README for more info.
      

       

      We need to add "m" flag on preg_replace :

        $mysql_ini = preg_replace('/^\s*#/m', ';', file_get_contents('/etc/mysql/debian.cnf')); 

      var_dump($mysql_ini);
      string(544) "; THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE.
      ; This file exists only for backwards compatibility for
      ; tools that run '--defaults-file=/etc/mysql/debian.cnf'
      ; and have root level access to the local filesystem.
      ; With those permissions one can run 'mariadb' directly
      ; anyway thanks to unix socket authentication and hence
      ; this file is useless. See package README for more info. 

      Attachments

        Activity

          People

            landy Mike Stupalov
            johann Johann Mallet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: