Warning
Error Code: 1760

MySQL Error 1760: Insecure Replica Credential Storage

📦 MySQL
📋

Description

This error indicates that MySQL has detected an attempt to store sensitive user credentials for replication in a manner it deems insecure. It typically occurs when configuring or starting a replica (slave) server, warning against persisting usernames and passwords directly in the connection metadata repository. MySQL recommends a more secure approach for handling these credentials.
💬

Error Message

Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
🔍

Known Causes

2 known causes
⚠️
Persistent Credentials in Metadata
Configuring replication using `CHANGE REPLICATION SOURCE TO` (or `CHANGE MASTER TO`) with `SOURCE_USER` and `SOURCE_PASSWORD` without enabling GTID-based auto-positioning, which leads to insecure storage in the replica's metadata repository.
⚠️
Overlooking Runtime Options
Failing to utilize the `USER` and `PASSWORD` options directly within the `START REPLICA` statement, which are designed for secure, non-persistent credential handling for the current session.
🛠️

Solutions

3 solutions available

1. Use START REPLICA with USER and PASSWORD Options easy

Directly provide replica user credentials within the START REPLICA command.

1
Stop the replica if it's currently running.
STOP REPLICA;
2
Start the replica, specifying the replication user and its password using the `USER` and `PASSWORD` options.
START REPLICA USER='replica_user', PASSWORD='replica_password';
-- Or if using SSL:
-- START REPLICA USER='replica_user', PASSWORD='replica_password', SSL_CA='/path/to/ca.pem', SSL_CERT='/path/to/client-cert.pem', SSL_KEY='/path/to/client-key.pem';
3
Verify the replica status.
SHOW REPLICA STATUS\G

2. Securely Store Credentials in a Separate File (Recommended) medium

Store replica user and password in a dedicated file and point START REPLICA to it.

1
Create a secure file to store the replication credentials. This file should have strict permissions (readable only by the MySQL user).
# Example: /etc/mysql/replication.cnf
[client]
user=replica_user
password=replica_password
2
Set appropriate file permissions to restrict access.
sudo chown mysql:mysql /etc/mysql/replication.cnf
sudo chmod 600 /etc/mysql/replication.cnf
3
Stop the replica if it's currently running.
STOP REPLICA;
4
Start the replica, referencing the credential file using the `SOURCE` option.
START REPLICA SOURCE='/etc/mysql/replication.cnf';
-- Or if using SSL:
-- START REPLICA SOURCE='/etc/mysql/replication.cnf', SSL_CA='/path/to/ca.pem', SSL_CERT='/path/to/client-cert.pem', SSL_KEY='/path/to/client-key.pem';
5
Verify the replica status.
SHOW REPLICA STATUS\G

3. Use MySQL Option Files for `mysqld` Configuration advanced

Configure replication credentials within the MySQL server's main configuration file or a dedicated option file for the `mysqld` process.

1
Edit your MySQL server's main configuration file (e.g., `/etc/my.cnf` or `/etc/mysql/mysql.conf.d/mysqld.cnf`) or create a new option file for replica settings.
# Example: Add to [mysqld] section or a dedicated [replication] section
[mysqld]
# ... other settings ...
relay-log=my-relay-log
read-only=1

[replication]
# These are used by START REPLICA if not specified directly
# However, START REPLICA will override these if USER/PASSWORD are provided
# This approach is more for automated startup scripts or when not using START REPLICA directly
# For START REPLICA, the previous methods are more direct for the error message.
2
If you need to specify replica user/password for automated startup without explicit `START REPLICA` commands, you'd typically set these in a script that calls `START REPLICA` with the `SOURCE` option pointing to a credential file, as shown in Solution 2. Directly embedding `replica-user` and `replica-password` in `my.cnf` is generally not the intended way to resolve this specific `START REPLICA` error, as the error points to connection metadata repository storage.
N/A (This step is explanatory)
3
Restart the MySQL server for changes to take effect. Note: This is a server-level change and might not be the most granular fix for the `START REPLICA` error itself, but it's a related secure configuration practice.
sudo systemctl restart mysql
🔗

Related Errors

5 related errors