bitpoke / mysql-operator

Asynchronous MySQL Replication on Kubernetes using Percona Server and Openark's Orchestrator.
https://www.bitpoke.io/docs/mysql-operator/getting-started/
Apache License 2.0
1.03k stars 275 forks source link

ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES) #900

Closed fengve closed 1 year ago

fengve commented 1 year ago
apiVersion: v1
kind: Secret
metadata:
  name: fwmysqltest-mysql-password
  namespace: bmmtest
data:
  PASSWORD: MTIzNDU2Nzg5MAo=

---
apiVersion: mysql.presslabs.org/v1alpha1
kind: MysqlUser
metadata:
  name: mysql-user-2
  namespace: bmmtest
spec:
  user: testuser
  clusterRef:
    name: fwmysqltest
    namespace: bmmtest
  password:
    name: fwmysqltest-mysql-password
    key: PASSWORD
  allowedHosts:
    - "%"
  permissions:
    - schema: "test1"
      tables: ["*"]
      permissions:
        - SELECT
        - DELETE
        - INSERT
        - UPDATE
    - schema: "mysql"
      tables: ["*"]
      permissions:
        - SELECT
    - schema: "*"
      tables: ["*"]
      permissions:
        - PROCESS
        - REPLICATION SLAVE
        - REPLICATION CLIENT


mysql> select * from mysql.user where user="testuser"\G;
*************************** 1. row ***************************
                  Host: %
                  User: testuser
           Select_priv: N
           Insert_priv: N
           Update_priv: N
           Delete_priv: N
           Create_priv: N
             Drop_priv: N
           Reload_priv: N
         Shutdown_priv: N
          Process_priv: Y
             File_priv: N
            Grant_priv: N
       References_priv: N
            Index_priv: N
            Alter_priv: N
          Show_db_priv: N
            Super_priv: N
 Create_tmp_table_priv: N
      Lock_tables_priv: N
          Execute_priv: N
       Repl_slave_priv: Y
      Repl_client_priv: Y
      Create_view_priv: N
        Show_view_priv: N
   Create_routine_priv: N
    Alter_routine_priv: N
      Create_user_priv: N
            Event_priv: N
          Trigger_priv: N
Create_tablespace_priv: N
              ssl_type:
            ssl_cipher:
           x509_issuer:
          x509_subject:
         max_questions: 0
           max_updates: 0
       max_connections: 0
  max_user_connections: 0
                plugin: mysql_native_password
 authentication_string: *9E36700412C95857CD42303213EB6DEEC58228DD
      password_expired: N
 password_last_changed: 2023-08-10 16:00:42
     password_lifetime: NULL
        account_locked: N

mysql> select * from mysql.db where user="testuser"\G;
*************************** 1. row ***************************
                 Host: %
                   Db: mysql
                 User: testuser
          Select_priv: Y
          Insert_priv: N
          Update_priv: N
          Delete_priv: N
          Create_priv: N
            Drop_priv: N
           Grant_priv: N
      References_priv: N
           Index_priv: N
           Alter_priv: N
Create_tmp_table_priv: N
     Lock_tables_priv: N
     Create_view_priv: N
       Show_view_priv: N
  Create_routine_priv: N
   Alter_routine_priv: N
         Execute_priv: N
           Event_priv: N
         Trigger_priv: N
*************************** 2. row ***************************
                 Host: %
                   Db: test1
                 User: testuser
          Select_priv: Y
          Insert_priv: Y
          Update_priv: Y
          Delete_priv: Y
          Create_priv: N
            Drop_priv: N
           Grant_priv: N
      References_priv: N
           Index_priv: N
           Alter_priv: N
Create_tmp_table_priv: N
     Lock_tables_priv: N
     Create_view_priv: N
       Show_view_priv: N
  Create_routine_priv: N
   Alter_routine_priv: N
         Execute_priv: N
           Event_priv: N
         Trigger_priv: N
2 rows in set (0.00 sec)

sh-4.4$ mysql -utestuser -p1234567890

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES)

kubectl logs 

2023-08-11T02:32:13.525995Z 258 [Warning] Following users were specified in CREATE USER IF NOT EXISTS but they already exist. Corresponding entry in binary log used default authentication plugin 'mysql_native_password' to rewrite authentication information(if any) for them: 'testuser'@'%'