Home > Database > Mysql Tutorial > body text

Why am I getting a 'Plugin 'auth_socket' is not loaded' error when connecting to MySQL?

Linda Hamilton
Release: 2024-11-13 04:15:02
Original
821 people have browsed it

Why am I getting a

MySQL Login Error: "Plugin 'auth_socket' is not loaded"

Problem: Attempts to connect to MySQL via CLI result in a series of errors, including "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded."

Solution:

This error occurs after resetting the root password and changing the authentication plugin to "mysql_native_password." To resolve it:

  1. Run Bash Commands:

    • Stop MySQL service: sudo /etc/init.d/mysql stop
    • Start MySQL without password: sudo mysqld_safe --skip-grant-tables &
    • Connect to MySQL as root: mysql -uroot
  2. Run MySQL Commands:

    • Use MySQL table: use mysql;
    • Update root user's password to an empty string: update user set authentication_string=PASSWORD("") where User='root';
    • Change root user's authentication plugin to "mysql_native_password": update user set plugin="mysql_native_password" where User='root';
    • Flush privileges: flush privileges;
    • Quit MySQL: quit;
  3. More Bash Commands:

    • Stop and restart MySQL: sudo /etc/init.d/mysql stop; sudo /etc/init.d/mysql start
    • Login to MySQL without entering a password: mysql -u root -p

Additional Tips:

  • If a socket error occurs, try these commands:

    • sudo mkdir -p /var/run/mysqld; sudo chown mysql /var/run/mysqld
    • mkdir -p /var/run/mysqld && chown mysql:mysql /var/run/mysqld
  • Instead of "localhost," use "127.0.0.1" for hostname:

    • mysql -uroot -h127.0.0.1
  • Skipping the "my.cnf" file may also resolve the issue.

The above is the detailed content of Why am I getting a 'Plugin 'auth_socket' is not loaded' error when connecting to MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template