Error 2061 occurs when the MySQL server selects an authentication plugin (usually caching_sha2_password in MySQL 8.0+) that the client cannot properly execute. Fix by using SSL/TLS, requesting the RSA public key, or changing the authentication plugin.
Error 2061 (CR_AUTH_PLUGIN_ERR) indicates that MySQL's authentication plugin system failed during the connection handshake. The server chooses a specific authentication method based on the user account configuration, but the client either doesn't support that method, lacks required encryption capabilities, or has outdated authentication libraries. This is a server-side authentication protocol enforcement that prevents the connection from completing.
Connect to MySQL as an administrator and verify which authentication plugin is assigned to your user:
SELECT User, Host, plugin FROM mysql.user WHERE User = 'your_username';Note the plugin name. If it shows caching_sha2_password or sha256_password, you've found the cause.
Alter the user to use the older, widely-supported mysql_native_password authentication method. This is the fastest way to restore connectivity:
ALTER USER 'your_username'@'your_host' IDENTIFIED WITH mysql_native_password BY 'your_password';
FLUSH PRIVILEGES;Replace your_username and your_host with the actual user and host. The host is often localhost for local connections or % for remote access. After running this, your client should connect successfully.
If you want to keep caching_sha2_password (more secure), establish an SSL/TLS connection to MySQL. This allows the plugin to transmit the password safely without RSA encryption fallback:
For mysql CLI:
mysql --ssl-mode=REQUIRED -u your_username -h your_host -pFor Node.js with mysql2/promise:
const connection = await mysql.createConnection({
host: 'your_host',
user: 'your_username',
password: 'your_password',
database: 'your_database',
ssl: 'amazon', // or true, or path to CA cert
});For other languages: Configure your database driver to use SSL (consult your library's documentation).
If you cannot use SSL, request the server to send its RSA public key so the client can encrypt the password:
For mysql CLI:
mysql --ssl-mode=DISABLED -u your_username -h your_host -p --get-server-public-keyFor Node.js with mysql2/promise:
const connection = await mysql.createConnection({
host: 'your_host',
user: 'your_username',
password: 'your_password',
database: 'your_database',
getServerPublicKey: true,
});This is less secure than SSL/TLS but allows the plugin to complete password exchange.
If you control the MySQL server and want to use mysql_native_password globally (not recommended for production, but useful for development), edit the MySQL configuration file:
On Linux/macOS:
Edit /etc/mysql/my.cnf or /usr/local/etc/my.cnf
On Windows:
Edit C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini
Add this under the [mysqld] section:
[mysqld]
default_authentication_plugin=mysql_native_passwordSave and restart MySQL:
# Linux
sudo systemctl restart mysql
# macOS
brew services restart mysql
# Windows (command prompt as admin)
net stop MySQL80
net start MySQL80New user accounts will now use mysql_native_password by default.
Test the connection with your database client:
mysql -u your_username -h your_host -p -e "SELECT 1;"If you see "1" in the output, the connection is successful. For application-level connections (Node.js, Python, PHP, etc.), test with a simple query to confirm the database is accessible.
The caching_sha2_password plugin is more secure than mysql_native_password because it uses SHA-256 hashing and includes built-in credential caching on the server side, reducing the computational load. However, it requires either an encrypted connection or RSA public key infrastructure. For development environments, switching to mysql_native_password is acceptable; for production systems handling sensitive data, prefer SSL/TLS connections with caching_sha2_password. Some MySQL distributions built with yaSSL (older Windows/macOS builds) may have restricted SSL support; check with SHOW VARIABLES LIKE 'have_ssl';. If using Docker, ensure your image includes mysql-community-server-plugins; Alpine/minimal images often omit these plugins, causing load failures.
ERROR 1064: You have an error in your SQL syntax
How to fix "ERROR 1064: You have an error in your SQL syntax" in MySQL
ERROR 1054: Unknown column in field list
Unknown column in field list
ER_WINDOW_RANGE_FRAME_NUMERIC_TYPE (3589): RANGE frame requires numeric ORDER BY expression
RANGE frame requires numeric ORDER BY expression in MySQL window functions
CR_ALREADY_CONNECTED (2058): Handle already connected
How to fix "CR_ALREADY_CONNECTED (2058): Handle already connected" in MySQL
ER_WINDOW_DUPLICATE_NAME (3591): Duplicate window name
How to fix ER_WINDOW_DUPLICATE_NAME (3591) in MySQL window functions