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

Regression: Error "authentication failed. Unknown database" when DB specified while connecting with rwsplit router

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • xpandmon

    Description

      [root@karma182 ~]# maxctrl list servers
      ┌───────────────────────────┬─────────────┬──────┬─────────────┬─────────────────┬──────┐
      │ Server                    │ Address     │ Port │ Connections │ State           │ GTID │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor:node-2  │ 10.2.15.89  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor:node-3  │ 10.2.15.180 │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor:node-1  │ 10.2.13.91  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor1:node-2 │ 10.2.15.75  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor1:node-3 │ 10.2.12.218 │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ @@Cluster-Monitor1:node-1 │ 10.2.15.40  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ BS1                       │ 10.2.13.91  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ BS4                       │ 10.2.15.40  │ 3306 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ MBS                       │ 127.0.0.1   │ 4006 │ 0           │ Master, Running │      │
      ├───────────────────────────┼─────────────┼──────┼─────────────┼─────────────────┼──────┤
      │ MBS2                      │ 127.0.0.1   │ 4007 │ 0           │ Slave, Running  │      │
      └───────────────────────────┴─────────────┴──────┴─────────────┴─────────────────┴──────┘
      

      [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4008 test
      mysql: [Warning] Using a password on the command line interface can be insecure.
      ERROR 1049 (42000): Unknown database 'test'
      

      If connection is created without specifying the DB, it works.

      [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4008
      mysql: [Warning] Using a password on the command line interface can be insecure.
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 9
      Server version: 5.5.5-10.2.12 2.4.1-maxscale
       
      Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
       
      Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      mysql> use test;
      Database changed
      

      karma136 has older MaxScale server installed and run with same conf file as karma182.

      [root@karma136 ~]# maxscale -V
      MaxScale 2.4.1 - 3940547cc20a15af0a8c420b55fe0cf39bdc4549
      

      The same works on that version:

       [root@vqc008c vqc008c]# mysql -h karma136 -umaxscale -pmaxscale_pw -P 4008 test
      mysql: [Warning] Using a password on the command line interface can be insecure.
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 15
      Server version: 5.0.45-clustrix-elk-14841
       
      Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
       
      Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      mysql> select @@version;
      +---------------------------------+
      | @@version                       |
      +---------------------------------+
      | 5.0.45-clustrix-fredonyer-16045 |
      +---------------------------------+
      1 row in set (0.01 sec)
      

      It seems to be looking for mysql tables:

      2019-08-15 06:13:04   info   : (4) [readwritesplit] Session command no. 2 failed: #HY000: [8192] Relation not found: "mysql"."roles_mapping"
      2019-08-15 06:13:04   info   : (4) > Autocommit: [enabled], trx is [not open], cmd: (0x03) COM_QUERY, plen: 14, type: QUERY_TYPE_SESSION_WRITE, stmt: USE mysql
      2019-08-15 06:13:04   info   : (4) [readwritesplit] Session write, routing to all servers.
      2019-08-15 06:13:04   info   : (4) [readwritesplit] Route query to master: @@Cluster-Monitor:node-1     [10.2.13.91]:3306
      2019-08-15 06:13:04   info   : (4) [readwritesplit] Reply complete, last reply from @@Cluster-Monitor:node-1
      2019-08-15 06:13:04   info   : (4) [readwritesplit] Session command no. 3 failed: #42000: [11267] No such database: "mysql"
      2019-08-15 06:13:04   error  : (3) [MariaDBAuth] Failed to load users from server 'MBS': [11267] No such database: "mysql"
      

      ERROR:

      2019-08-15 06:13:04   warning: (3) [MariaDBAuth] Read-Write-Service_rwsrvc: login attempt for user 'maxscale'@[::ffff:10.2.14.197]:38730, authentication failed. Unknown database: test
      

      Log and cnf file attached.

      Attachments

        Activity

          johan.wikman Johan Wikman added a comment -

          Are the privileges of the maxscale user exactly the same on both Clustrix installations?

          johan.wikman Johan Wikman added a comment - Are the privileges of the maxscale user exactly the same on both Clustrix installations?
          rahul.joshi@mariadb.com Rahul Joshi (Inactive) added a comment - - edited

          Yeah, they are the same

          [root@karma182 ~]# mysql -h 10.2.15.40 -u maxscale -pmaxscale_pw -e "show grants for maxscale@'%'"
          +---------------------------------------------------------------+
          | Grants for maxscale@%                                         |
          +---------------------------------------------------------------+
          | GRANT ALL PRIVILEGES ON *.* TO 'maxscale'@'%'                 |
          | GRANT SELECT ON `system`.`membership` TO 'maxscale'@'%'       |
          | GRANT SELECT ON `system`.`nodeinfo` TO 'maxscale'@'%'         |
          | GRANT SELECT ON `system`.`softfailed_nodes` TO 'maxscale'@'%' |
          +---------------------------------------------------------------+
          [root@karma182 ~]# mysql -h 10.2.13.91 -u maxscale -pmaxscale_pw -e "show grants for maxscale@'%'"
          +---------------------------------------------------------------+
          | Grants for maxscale@%                                         |
          +---------------------------------------------------------------+
          | GRANT ALL PRIVILEGES ON *.* TO 'maxscale'@'%'                 |
          | GRANT SELECT ON `system`.`membership` TO 'maxscale'@'%'       |
          | GRANT SELECT ON `system`.`nodeinfo` TO 'maxscale'@'%'         |
          | GRANT SELECT ON `system`.`softfailed_nodes` TO 'maxscale'@'%' |
          +---------------------------------------------------------------+
          

          Also, if I use port 4006 or port 4007 (used by individual listeners for two Clustrix clusters), it works.

          [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4006 test
          mysql: [Warning] Using a password on the command line interface can be insecure.
          Reading table information for completion of table and column names
          You can turn off this feature to get a quicker startup with -A
           
          Welcome to the MySQL monitor.  Commands end with ; or \g.
          Your MySQL connection id is 5
          Server version: 5.0.45-clustrix-fredonyer-16045
           
          Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
           
          Oracle is a registered trademark of Oracle Corporation and/or its
          affiliates. Other names may be trademarks of their respective
          owners.
           
          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
           
          mysql> \q
          Bye
          ---------------------------------------------------------------------------------------
          [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4007 test
          mysql: [Warning] Using a password on the command line interface can be insecure.
          Welcome to the MySQL monitor.  Commands end with ; or \g.
          Your MySQL connection id is 6
          Server version: 5.5.5-10.2.12 2.4.1-maxscale
           
          Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
           
          Oracle is a registered trademark of Oracle Corporation and/or its
          affiliates. Other names may be trademarks of their respective
          owners.
           
          Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
           
          mysql> \q
          Bye
          ---------------------------------------------------------------------------------------
          [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4008 test
          mysql: [Warning] Using a password on the command line interface can be insecure.
          ERROR 1049 (42000): Unknown database 'test'
          [root@vqc008c vqc008c]#
          

          rahul.joshi@mariadb.com Rahul Joshi (Inactive) added a comment - - edited Yeah, they are the same [root@karma182 ~]# mysql -h 10.2.15.40 -u maxscale -pmaxscale_pw -e "show grants for maxscale@'%'" +---------------------------------------------------------------+ | Grants for maxscale@% | +---------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`membership` TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`nodeinfo` TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`softfailed_nodes` TO 'maxscale'@'%' | +---------------------------------------------------------------+ [root@karma182 ~]# mysql -h 10.2.13.91 -u maxscale -pmaxscale_pw -e "show grants for maxscale@'%'" +---------------------------------------------------------------+ | Grants for maxscale@% | +---------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`membership` TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`nodeinfo` TO 'maxscale'@'%' | | GRANT SELECT ON `system`.`softfailed_nodes` TO 'maxscale'@'%' | +---------------------------------------------------------------+ Also, if I use port 4006 or port 4007 (used by individual listeners for two Clustrix clusters), it works. [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4006 test mysql: [Warning] Using a password on the command line interface can be insecure. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A   Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.0.45-clustrix-fredonyer-16045   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.   Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   mysql> \q Bye --------------------------------------------------------------------------------------- [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4007 test mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.5.5-10.2.12 2.4.1-maxscale   Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.   Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.   mysql> \q Bye --------------------------------------------------------------------------------------- [root@vqc008c vqc008c]# mysql -h karma182 -umaxscale -pmaxscale_pw -P 4008 test mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1049 (42000): Unknown database 'test' [root@vqc008c vqc008c]#

          Attaching the logs (maxscale_2.log ) with just this one attempt to connect with DB name specified.

          rahul.joshi@mariadb.com Rahul Joshi (Inactive) added a comment - Attaching the logs (maxscale_2.log ) with just this one attempt to connect with DB name specified.
          AdB Adrien added a comment -

          FYI,

          I had the exact same problem.
          I was missing the 'SHOW DATABASES' privilege

          GRANT SHOW DATABASES ON *.* TO 'maxscale'@'maxscalehost';
          

          https://mariadb.com/kb/en/maxscale-troubleshooting/

          AdB Adrien added a comment - FYI, I had the exact same problem. I was missing the 'SHOW DATABASES' privilege GRANT SHOW DATABASES ON *.* TO 'maxscale'@'maxscalehost'; https://mariadb.com/kb/en/maxscale-troubleshooting/
          markus makela markus makela added a comment -

          rahul.joshi@mariadb.com is this still relevant?

          markus makela markus makela added a comment - rahul.joshi@mariadb.com is this still relevant?

          People

            Unassigned Unassigned
            rahul.joshi@mariadb.com Rahul Joshi (Inactive)
            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.