🍼 Как решить ошибку MySQL в Debian / Ubuntu “ERROR 1524 (HY000): Plugin ‘unix_socket’ is not loaded ”

by itisgood

Недавно я столкнулся с этой ошибкой «ERROR 1524 (HY000): Plugin ‘unix_socket’ is not loaded » на моем сервере Debian 9 при попытке аутентификации в базе данных MariaDB от имени пользователя root.

После некоторого поиска в Google я нашел способ обойти эту ошибку – запустить службу MySQL с mysqld_safe и сбросить пароль root.

Шаг 1: Остановить службу MySQL

Остановите службу MySQL.

$ sudo systemctl stop mysql
или
$ sudo /etc/init.d/mysql stop

Шаг 2: Запустите mysql с помощью mysqld_safe

Затем запустите службу mysql с mysqld_safe и параметром –skip-grant-tables он должен дальше работать в фоновом режиме.

$ sudo mysqld_safe --skip-grant-tables &
[1] 8197

Шаг 3: Сброс пароля пользователя root

Откройте консоль MySQL.

$ mysql -uroot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.14-MariaDB-1:10.3.14+maria~stretch mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Вы должны добраться до терминала MySQL без аутентификации по паролю.

Теперь переключитесь на базу данных mysql.

MariaDB [(none)]> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

Сбросьте пароль пользователя root.

MariaDB [mysql]> update user set password=PASSWORD("NewRootPassword") where User='root';
Query OK, 0 rows affected (0.002 sec)
Rows matched: 1  Changed: 0  Warnings: 0

Замените NewRootPassword своим новым паролем для пользователя root.

Также установите плагин аутентификации на native

MariaDB [mysql]> UPDATE USER SET plugin="mysql_native_password";
Query OK, 2 rows affected (0.001 sec)
Rows matched: 2  Changed: 2  Warnings: 0

Закройте сеанс базы данных.

MariaDB [mysql]> quit;
Bye

Шаг 4: Сброс пароля пользователя root

Перезапустите службу MySQL стандартным способом. Но сначала остановите сервис

$ sudo systemctl stop mysql
или
$ /etc/init.d/mysql stop

Убедитесь, что другой процесс не запущен.

ps aux | grep mysql

Запустите MySQL.

sudo systemctl start mysql

Проверьте доступ от имени пользователя root.

$ mysql -u root -p
Enter password: <Enter Password Set>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.14-MariaDB-1:10.3.14+maria~stretch mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> QUIT
Bye

Похожие статьи:

 

You may also like

Leave a Comment