MySQL ERROR 1524: the auth_socket plugin is not loaded
ERROR 1524 (HY000): Plugin 'auth_socket' is not loadedShort answer
The account is set to authenticate with auth_socket, but the server has not loaded that plugin. On MySQL, load auth_socket.so with INSTALL PLUGIN or plugin-load-add in my.cnf and restart. On MariaDB, install the plugin with INSTALL SONAME and create accounts with IDENTIFIED VIA unix_socket.
Fix it fast
1Find out which cause you have
Check which plugin each account uses and whether the server has auth_socket loaded.
sudo mysql -e "SELECT user, host, plugin FROM mysql.user;" sudo mysql -e "SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%socket%';"2Match what you see, then jump to its fix
What does the error look like?
ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded
Cause 1 of 2
MySQL server started without the auth_socket plugin
1Check
The MySQL manual says auth_socket is a server-side plugin in auth_socket.so, found in the directory named by plugin_dir. It works on Linux through SO_PEERCRED.
sudo mysql -e "SHOW VARIABLES LIKE 'plugin_dir';"
# then list that directory for auth_socket.so2Fix
Load it at runtime, which also registers it for later restarts. If you cannot log in at all, add plugin-load-add=auth_socket.so under [mysqld] in my.cnf and restart the server.
INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
-- or in my.cnf
-- [mysqld]
-- plugin-load-add=auth_socket.so3Verify
The plugin shows as ACTIVE and the socket login works for the matching OS user.
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%socket%';Confirmed by dev.mysql.com
Cause 2 of 2
The server is MariaDB, where the plugin is named unix_socket
1Check
MariaDB documents the library as auth_socket, installed in almost all versions by default, and accounts are created with IDENTIFIED VIA unix_socket.
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE '%socket%';2Fix
Install the plugin if the row is missing, then create or change the account with MariaDB syntax. Do not use IDENTIFIED WITH.
INSTALL SONAME 'auth_socket';
CREATE USER username@localhost IDENTIFIED VIA unix_socket;3Verify
Log in as the OS user that matches the account name.
mariadb -u usernameConfirmed by mariadb.com
How do I stop it coming back?
- Keep one database server family per host and write user-creation SQL for that family only.
- After restoring a mysql.user dump from another server, run the plugin query before the first login test.
- Keep one working admin login path open before changing authentication plugins.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
An EC2 instance cannot reach its RDS database
Could not open connection to the host, on port <port>: Connect failed
RDS denies all access until a security group allows it.
3 causes, each with a fixDatabases
Locked out of a fresh MariaDB install as root on Mac or Linux
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
A fresh MariaDB root account is not a normal password account.
3 causes, each with a fixDatabases
An Aria table fails with 'Read page with wrong checksum' (error 1030, code 176)
ERROR 1030 (HY000): Got error 176 "Read page with wrong checksum" from storage engine Aria
Code 176 means MariaDB's Aria engine read a data or index page whose checksum does not match, so that table file is damaged.
3 causes, each with a fixDatabases
The client cannot open a TCP connection to MariaDB or MySQL (error 2003)
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:3306' (111)
Error 2003 means the client tried a TCP connection to the host and port and nobody answered.
4 causes, each with a fix