MySQL 8.0 native authentication¶
MySQL 8.0 native authentication refers to the use of the mysql_native_password plugin as the default authentication mechanism in MySQL version 8.0.^[600-developer__database__mysql__mysql8-portable.md]
Configuration¶
In MySQL 8.0, the system defaults to the caching_sha2_password plugin; however, configuration can be modified to use mysql_native_password for compatibility with older client versions.^[600-developer__database__mysql__mysql8-portable.md]
To set this default behavior globally, the default_authentication_plugin directive must be defined in the my.ini configuration file.^[600-developer__database__mysql__mysql8-portable.md]
[mysqld]
default_authentication_plugin=mysql_native_password
User Management¶
When defining or altering users, the authentication method can be explicitly specified using the IDENTIFIED WITH clause followed by the plugin name and a password.^[600-developer__database__mysql__mysql8-portable.md]
For example, to alter a user to use native authentication:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
This command updates the user record to utilize the native password plugin and sets the corresponding password.^[600-developer__database__mysql__mysql8-portable.md]
Related Concepts¶
- [[MySQL]]
- [[Database Security]]
- [[SQL]]
Sources¶
^[600-developer__database__mysql__mysql8-portable.md]