[MDEV-15498] replication connect engine Slave: Access denied for user ''@'' (using password: NO) Error_code: 1045 Created: 2018-03-07  Updated: 2023-07-05  Resolved: 2020-11-30

Status: Closed
Project: MariaDB Server
Component/s: Replication, Storage Engine - Connect
Affects Version/s: 10.2
Fix Version/s: 10.2.29, 10.3.20, 10.4.10

Type: Bug Priority: Critical
Reporter: Na Yun Ho Assignee: Andrei Elkin
Resolution: Fixed Votes: 1
Labels: replication

Issue Links:
Relates
relates to MDEV-25157 Replication ignores --slave_skip_err... Open

 Description   

Mariadb-10.2.13 (MASTER)
Mariadb-10.2.13 (SLAVE)

use config MASTER/SLAVE replication AND Oracle connect engine

[SLAVE Status]

Last_Error: Error executing row event: 'Access denied for user ''@'' (using password: NO)'
.
Last_SQL_Error: Error executing row event: 'Access denied for user ''@'' (using password: NO)'

=====================================================================
[SLAVE Error]

2018-03-07 10:50:12 139672396281600 [ERROR] Slave SQL: Error executing row event: 'Access denied for user ''@'' (using password: NO)', Gtid 0-1-2431744, Internal MariaDB error code: 1045
2018-03-07 10:50:12 139672396281600 [Warning] Slave: Access denied for user ''@'' (using password: NO) Error_code: 1045
2018-03-07 10:50:12 139672396281600 [Warning] Slave: Got error 122 'This operation requires the FILE privilege' from CONNECT Error_code: 1296
2018-03-07 10:50:12 139672396281600 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000131' position 628823487
2018-03-07 10:50:12 139674090174208 [Note] Slave SQL thread exiting, replication stopped in log 'mysql-bin.000131' at position 628823487

======================================================================
[Master Query]

#180307  3:47:34 server id 1  end_log_pos 628823487 CRC32 0xb6d494b1    Query   thread_id=575007        exec_time=0     error_code=0
SET TIMESTAMP=1520362054/*!*/;
CREATE OR REPLACE TABLE `ora_ctx_t_ctx_dspy_cate_m` (
  `DSPY_CATE_ID` int(11) NOT NULL,
  `ROOT_DSPY_CATE_ID` int(11) NOT NULL,
  `DSPY_CATE_NM` varchar(200) DEFAULT NULL,
  `UPPER_DSPY_CATE_ID` int(11) DEFAULT NULL,
  `EXPSR_YN` char(1) DEFAULT NULL,
  `REPR_YN` char(1) DEFAULT NULL,
  `CTN` varchar(1000) DEFAULT NULL,
  `SORT_SEQ` int(11) DEFAULT NULL,
  `USE_YN` char(1) DEFAULT NULL,
  `REG_ID` varchar(13) DEFAULT NULL,
  `REG_DT` datetime DEFAULT current_timestamp(),
  `UPD_ID` varchar(13) DEFAULT NULL,
  `UPD_DT` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='Driver=oracle;DSN=pcerp;UID=ctxowner;PWD=ctxowner' `TABLE_TYPE`=ODBC `tabname`='T_CTX_DSPY_CATE_M'
/*!*/;
# at 628823487



 Comments   
Comment by Hartmut Holzgraefe [ 2020-04-16 ]

Even if not running into the "access denied" problem, replicating CONNECT table changes does not make that much sense. E.g. INSERT statements could easily cause duplicate key errors if master and slave are set up to use the same remote table.

The table has been modified on the slave side to use a different CONNECTION string, pointing at a different external table, replication should work though and not fail on authentication.

Comment by Julien Fritsch [ 2020-05-04 ]

bertrandop hi, any help possible on this bug, please?

Comment by Olivier Bertrand [ 2020-05-04 ]

In CONNECT, access permission has been handled by Alexander Barkov.

Comment by Julien Fritsch [ 2020-05-05 ]

Thank you bertrandop

Comment by Hartmut Holzgraefe [ 2020-09-01 ]

On connect target host named "connect":

CREATE USER conn@'%' IDENTIFIED BY 'secret';
GRANT ALL ON test.* TO conn@'%' IDENTIFIED BY 'secret';
 
USE test;
 
CREATE TABLE `t1` (
        id int primary key,
        msg varchar(100));
 
INSERT INTO  t1 VALUES (1, 'initial on connect target');

On master

USE test;
 
CREATE TABLE `t1_c` (
        id int primary key,
        msg varchar(100)
) ENGINE=CONNECT DEFAULT CHARSET=utf8 CONNECTION='mysql://conn:secret@connect/test/t1'`table_type`=MYSQL;
 
SELECT * FROM t1_c;
 
+----+---------------------------+
| id | msg                       |
+----+---------------------------+
|  1 | initial on connect target |
+----+---------------------------+

On slave

SHOW SLAVE STATUS\G
 
  [..]
   Slave_IO_Running: Yes
   Slave_SQL_Running: Yes
  [..]
 
SELECT * FROM t1_c;
 
+----+---------------------------+
| id | msg                       |
+----+---------------------------+
|  1 | initial on connect target |
+----+---------------------------+

So we verified that slave works OK so far and can read from connect host.

Now on master:

INSERT INTO t1_c VALUES(2,'test');
 
SELECT * FROM t1_c;
 
+----+---------------------------+
| id | msg                       |
+----+---------------------------+
|  1 | initial on connect target |
|  2 | test                      |
+----+---------------------------+

Check connect target table on "connect" host

SELECT * FROM t1;
 
+----+---------------------------+
| id | msg                       |
+----+---------------------------+
|  1 | initial on connect target |
|  2 | test                      |
+----+---------------------------+

Check slave:

MariaDB [test]> SELECT * FROM t1_c;
+----+---------------------------+
| id | msg                       |
+----+---------------------------+
|  1 | initial on connect target |
|  2 | test                      |
+----+---------------------------+
 
SHOW SLAVE STATUS\G
 
  [...]
  Slave_IO_Running: Yes
  Slave_SQL_Running: No
  [...]
  Last_Errno: 1045
  Last_Error: Error executing row event: 'Access denied for user ''@'' (using password: NO)'
  [...]

So the slave can still read from the connect host just fine, but the related INSERT row event received from the master failed with "Access denied"

Comment by Andrei Elkin [ 2020-10-14 ]

Must be a replication issue, apparently the slave applier does not run or miss authentication of part of the connect engine access. Continue with reproducing within a day to add up more.

Comment by Hartmut Holzgraefe [ 2020-11-30 ]

Behavior changed between 10.2.27 and 10.2.29, from "Access denied" to "CONNECT Unsupported command"

Comment by Ján Regeš [ 2021-03-15 ]

Hi,

please, how was solved this issue? We use MariaDB 10.4.18.

When there is an INSERT into CONNECT table on MASTER, the same INSERT is executed on SLAVE and (SHOW SLAVE STATUS) ends with ErrNo 1148 - "Error executing row event: 'CONNECT Unsupported command'".

After that, replication is stopped despite the fact we have configured slave_skip_errors=1036,1050,1062,1125,1148,1296,1304,1537 (so error 1148 is in this directive, but replication is stopped).

For our use-case, it will be optimal to skip/disable INSERT commands into CONNECT tables on SLAVE by some directive. But also slave_skip_errors will be good solution, when it will be works as expected.

Thank you for your response.

Comment by Alice Sherepa [ 2021-03-16 ]

I reported the issue separately, MDEV-25157. The problem is with row replication, it stops with 'CONNECT Unsupported command'.
In case of the statement/mixed replication - it works as expected ( 1.there will be an error in case of the unique key, inserting twice, but slave_skip_errors will keep slave running 2. if there is no unique key- then the value will be inserted twice 3. scenario, where on slave connect table was altered to point to the different table than on master, also works)

Generated at Thu Feb 08 08:21:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.