Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-4489

PHP program reports different collation_connection when connecting via Maxscale

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.5.24, 6.4.5, 22.08.4
    • 2.5.25, 6.4.6, 22.08.5
    • Core
    • None

    Description

      Having a server with

      [server]
      character-set-server  = utf8mb3
      collation-server      = utf8mb3_swedish_ci
      

      the command line client, return "utf8mb3_general_ci" as result of

      SHOW VARIABLES LIKE 'collation_connection';

      both when connecting to the MariaDB server directly, and when connecting via Maxscale.

      A PHP program on the other hand also returns "utf8mb3_general_ci" when connecting via Maxscale, but "utf8mb3_swedish_ci" when connecting to MariaDB server directly.

      This breaks PHP applications that do not explicitly set client character set / collation.

      PHP test code I used:

      <?php
       
      function test($host) 
      {
        $mysqli = new mysqli($host,"vagrant","Secret23!");
        if ($mysqli -> connect_errno) {
          echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
          exit();
        }
        echo "Host: $host\n";
        if ($result = $mysqli -> query("SHOW VARIABLES LIKE 'collation_connection'")) {
          while($row = mysqli_fetch_assoc($result)){
            print_r($row);
          }
          $result -> free_result();
        }
        echo "\n";
        $mysqli -> close();
      }
       
      test("master");
      test("maxscale");
      ?>
      

      Note that PHP does not use a bundled version of libmysqlclient anymore by default, but its own "mysqlnd" implementation of the client protocol.

      Attachments

        Activity

          hholzgra Hartmut Holzgraefe created issue -
          markus makela markus makela made changes -
          Field Original Value New Value
          Assignee markus makela [ <markus.makela ]
          toddstoffel Todd Stoffel (Inactive) made changes -
          Rank Ranked higher
          markus makela markus makela made changes -
          Fix Version/s 22.08 [ 25001 ]
          markus makela markus makela made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          markus makela markus makela made changes -
          Fix Version/s 2.5.25 [ 28552 ]
          Fix Version/s 6.4.6 [ 28560 ]
          Fix Version/s 22.08.5 [ 28563 ]
          Fix Version/s 22.08 [ 25001 ]
          markus makela markus makela made changes -
          Affects Version/s 6.4.5 [ 28538 ]
          Affects Version/s 2.5.24 [ 28535 ]
          markus makela markus makela made changes -
          Status In Progress [ 3 ] In Review [ 10002 ]
          markus makela markus makela made changes -
          Component/s Core [ 11600 ]
          Resolution Fixed [ 1 ]
          Status In Review [ 10002 ] Closed [ 6 ]
          mariadb-jira-automation Jira Automation (IT) made changes -
          Zendesk Related Tickets 112652

          People

            markus makela markus makela
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.