The error code MY-002061 in MySQL 8.4.1 typically relates to an issue with the replication setup, particularly with the authentication plugin being used. Here are the steps you can take to resolve this issue:
1.**Change the Authentication Plugin**: Since MySQL 8.4 does not enable the `mysql_native_password` plugin by default, and it is completely removed in MySQL 9.0, you need to update your replication user to use the `caching_sha2_password` plugin.
```sql
ALTER USER 'replication_user'@'%' IDENTIFIED WITH 'caching_sha2_password' BY 'your_password';
```
This ensures that the user is using an authentication method compatible with MySQL 8.4 and later versions【7†source】【8†source】.
2. **Update the Replication Configuration**: You may also need to modify the replication configuration to use the new authentication method. Add `GET_MASTER_PUBLIC_KEY=1` to your `CHANGE MASTER TO` statement:
```sql
CHANGE MASTER TO MASTER_HOST='source_host',
MASTER_USER='replication_user',
MASTER_PASSWORD='your_password',
MASTER_AUTO_POSITION=1,
GET_MASTER_PUBLIC_KEY=1;
```
This command configures the replica to request the master's public key, which is necessary for secure connections【6†source】【9†source】.
3. **Verify User Plugins**: Ensure that there are no users still relying on the deprecated `mysql_native_password` plugin by running the following query:
```sql
SELECT user, host, plugin FROM mysql.user WHERE plugin='mysql_native_password';
```
Update any users found by this query to use the `caching_sha2_password` plugin as shown in the first step【7†source】.
4. **Check Master and Slave Configuration**: Ensure that both the master and slave servers are configured correctly, especially regarding the paths and permissions of key files. Verify the configuration with:
```sql
SHOW GLOBAL VARIABLES LIKE 'caching_sha2_password_public_key_path';
```
Copy the public key file from the master to the slave if necessary, and adjust the `CHANGE MASTER TO` statement accordingly to specify the path to the public key on the slave【6†source】.
By following these steps, you should be able to resolve the MY-002061 error and get your MySQL replication working properly. If issues persist, consider checking the MySQL error log for more detailed messages that might provide additional insights into the problem.
CREATE USER "repluser"@"%" IDENTIFIED BY "P@ssw0rd";
CHANGE MASTER TO MASTER_HOST='10.8.62.85',
MASTER_USER='repluser',
MASTER_PASSWORD='P@ssw0rd',
MASTER_AUTO_POSITION=1,
GET_MASTER_PUBLIC_KEY=1;
ALTER USER 'repluser'@'%' IDENTIFIED WITH 'caching_sha2_password' BY 'P@ssw0rd';
FLUSH PRIVILEGES;
SELECT user, host, plugin FROM mysql.user WHERE user = 'repluser' AND host = '%';
SELECT user, host, plugin
FROM mysql.user
WHERE plugin NOT IN ('caching_sha2_password', 'mysql_native_password', 'sha256_password');