How to switch the Mysql authentication method

Webner Solutions
3 min readSep 17, 2021

--

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.

How to switch the Mysql authentication method
How to switch the Mysql authentication method
  • 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 Mysql 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;

To configure the MySQL 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’

Now run the following command to flush the tables and implement new changes

mysql> FLUSH PRIVILEGES;

Now you can see we have changed the MySql 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.

Originally published at https://blog.webnersolutions.com on September 17, 2021.

--

--

Webner Solutions
Webner Solutions

Written by Webner Solutions

Our team in Salesforce is very strong, with in-depth knowledge of Salesforce classic and Lightning development as well as the Service cloud.

No responses yet