EmergencyEMERGENCY? Get 24/7 Help Now!

Change user password in MySQL 5.7 with “plugin: auth_socket”

 | March 16, 2016 |  Posted In: MySQL


change user password in MySQLIn this blog, we’ll discuss how to use “plugin: auth_socket” to change user password in MySQL 5.7. In

In Debian/Ubuntu it is pretty common to install MySQL/Percona Server with an empty password for the root user. After everything is configured and tested, then a password is set. This is not a good practice in production servers (or soon-to-be production servers), but you can do it for your own test servers. With regards to authentication, things have changed a bit in 5.7, and methods that worked before now need a different procedure.

Let’s say that you install 5.7 and don’t specify a password. You will see the following:

OK, the password is empty. Let’s change it:

That doesn’t work, it’s still empty:

But why? Let’s check the warnings:

The problem is in the note coded 1699. This user is using an authentication plugin that doesn’t support a password. Which one could it be?

Ok, auth_socket. If you install 5.7 and don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username.

If we want to configure a password, we need to change the plugin and set the password at the same time, in the same command. First changing the plugin and then setting the password won’t work, and it will fall back to auth_socket again. So, run:

So, the correct way to do this is to run the following:

And now, it works 🙂

If your deployments use empty passwords, and you change them later on, remember to update your scripts/recipes!

Miguel Angel Nieto

Miguel joined Percona in October 2011. He has worked as a System Administrator for a Free Software consultant and in the supporting area of the biggest hosting company in Spain. His current focus is improving MySQL and helping the community of Free Software to grow.


Leave a Reply