How to switch the Mysql authentication method from auth_socket to mysql_native_password

Author - Webner
17.09.2021
|
0 Comments
|

In this article, we will come to know how we can switch the MySQL root user default (Auth_Socket) authentication method to mysql_native_password.

  • Auth_socket Authentication

    Auth_socket authentication is a server-side default authentication plugin that is used to authenticate the client input in order to access databases. Auth_Socket authentication plugin uses the SO_PEERCRED Unix socket option to obtain information about the user running the client program.

  • Mysql_native_password Authentication

    The other authentication method is mysql_native_password authentication which is known as a traditional method to authenticate, it is not secure as Auth_socket authentication it uses just a hash of the password. This authentication method is not recommended for authentication.

The process to switch auth_socket to mysql_native_password:

First of all, check the current authentication method for this you can use the following command.

mysql> SELECT user, authentication_string,plugin,host FROM mysql.user;
Mysql
To configure the root account to authenticate with a password, run the following ALTER USER command. Be sure to change the password to a strong password of your choosing

mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’
mysql1
Now run the following command to flush the tables and implement new changes

mysql> FLUSH PRIVILEGES;
cmd
Now you can see we have changed the authentication method from auth_socket to mysql_native_password.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *