Skip to content

Instantly share code, notes, and snippets.

@rohsyl
Last active December 4, 2023 07:42
  • Star 9 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
MariaDB switch to mysql_native_password

Switch to mysql_native_password plugin

By default MariaDB use the unix_socket plugin to authenticate users.

But it's easier to use mysql_native_password for dev (and only for dev because it's way less secure).

Get root access

sudo su

Connect to mysql

mysql

Run this query

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD('foo');

And then

flush privileges;

Enjoy !

@Nilpo
Copy link

Nilpo commented May 12, 2022

This no longer works in modern version of MariaDB 10.4.3+. Use this query instead.

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD('foo');

You can also find more information at https://mariadb.com/kb/en/authentication-plugin-unix-socket/.

@akrambazina
Copy link

Works with Mariadb 10.3 perfect. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment