MySQL 실패 : mysql "오류 1524 (HY000) : 플러그인 'auth_socket'이로드되지 않았습니다."
내 지역 환경은 다음과 같습니다.
- 신선한 Ubuntu 16.04
- PHP 7
MySQL 5.7이 설치된 경우
sudo apt-get install mysql-common mysql-server
MySQL에 로그인하려고 할 때 (CLI를 통해) :
mysql -u root -p
3 단계의주기적인 문제를 발견했습니다.
1) 먼저 소켓 문제
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
해결 방법 : PC를 다시 시작합니다.
다른 오류가 발생했습니다.
2) 액세스가 거부 된 경우
ERROR 1698 (28000): Access denied for user 'root'@'localhost'.
가능한 문제? "루트"사용자의 비밀번호가 잘못되었습니다!
해결 방법 : 이 자습서로 루트 암호를 재설정하십시오 .
올바른 암호와 작동중인 소켓을 사용하면 마지막 오류가 발생합니다.
3) 잘못된 인증 플러그인
mysql "ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded"
여기서 나는 멈췄거나 어떻게 든 1)에 다시 도착했습니다.
나는 해결책을 얻었다!
2) 단계에서 루트 비밀번호를 재설정 할 때 인증 플러그인도 다음과 같이 변경하십시오 mysql_native_password
.
use mysql;
update user set authentication_string=PASSWORD("") where User='root';
update user set plugin="mysql_native_password" where User='root'; # THIS LINE
flush privileges;
quit;
이를 통해 성공적으로 로그인 할 수있었습니다!
전체 코드 솔루션
1. bash 명령 실행
1. 먼저 다음 bash 명령을 실행하십시오.
sudo /etc/init.d/mysql stop # stop mysql service
sudo mysqld_safe --skip-grant-tables & # start mysql without password
# enter -> go
mysql -uroot # connect to mysql
2. 그런 다음 mysql 명령을 실행하십시오 => 이것을 cli에 수동으로 붙여 넣으십시오.
use mysql; # use mysql table
update user set authentication_string=PASSWORD("") where User='root'; # update password to nothing
update user set plugin="mysql_native_password" where User='root'; # set password resolving to default mechanism for root user
flush privileges;
quit;
3. 더 많은 bash 명령 실행
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start # reset mysql
# try login to database, just press enter at password prompt because your password is now blank
mysql -u root -p
4. 소켓 문제 (귀하의 의견에서)
소켓 오류가 표시되면 커뮤니티에서 두 가지 가능한 솔루션을 제공했습니다.
sudo mkdir -p /var/run/mysqld; sudo chown mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables &
(@Cerin에게 감사드립니다)
또는
mkdir -p /var/run/mysqld && chown mysql:mysql /var/run/mysqld
(@Peter Dvukhrechensky에게 감사드립니다)
블라인드 경로 및 가능한 가장자리 오류
localhost 대신 127.0.0.1 사용
mysql -uroot # "-hlocalhost" is default
"파일 누락"또는 slt 오류가 발생할 수 있습니다.
mysql -uroot -h127.0.0.1
더 잘 작동합니다.
소켓 문제 건너 뛰기
mysqld.sock
파일 생성 , 액세스 권한 변경 또는 심볼릭 링크 방법을 많이 찾았 습니다. 결국 문제가 아니었다.
my.cnf
파일 건너 뛰기
문제도 거기에 없었습니다. 확실하지 않은 경우 도움이 될 수 있습니다 .
다음과 같이 시도해 볼 수 있습니다.
서버 시작 :
sudo service mysql start
이제 양말 폴더로 이동하십시오.
cd /var/run
양말 백업 :
sudo cp -rp ./mysqld ./mysqld.bak
서버 중지 :
sudo service mysql stop
양말 복원 :
sudo mv ./mysqld.bak ./mysqld
mysqld_safe를 시작합니다.
sudo mysqld_safe --skip-grant-tables --skip-networking &
Init mysql shell:
mysql -u root
Change password:
Hence, First choose the database
mysql> use mysql;
Now enter below two queries:
mysql> update user set authentication_string=password('123456') where user='root';
mysql> update user set plugin="mysql_native_password" where User='root';
Now, everything will be ok.
mysql> flush privileges;
mysql> quit;
For checking:
mysql -u root -p
done!
N.B, After login please change the password again from phpmyadmin
Now check hostname/phpmyadmin
Username: root
Password: 123456
For more details please check How to reset forgotten password phpmyadmin in Ubuntu
You can try these some steps:
Stop Mysql Service 1st sudo /etc/init.d/mysql stop
Login as root without password sudo mysqld_safe --skip-grant-tables &
After login mysql terminal you should need execute commands more:
use mysql;
UPDATE mysql.user SET authentication_string=PASSWORD('solutionclub3@*^G'), plugin='mysql_native_password' WHERE User='root';
flush privileges;
sudo mysqladmin -u root -p -S /var/run/mysqld/mysqld.sock shutdown
After you restart your mysql server If you still facing error you must visit : Reset MySQL 5.7 root password Ubuntu 16.04
The mysql
command by default uses UNIX sockets to connect to MySQL.
If you're using MariaDB, you need to load the Unix Socket Authentication Plugin on the server side.
You can do it by editing the [mysqld]
configuration like this:
[mysqld]
plugin-load-add = auth_socket.so
Depending on distribution, the config file is usually located at /etc/mysql/
or /usr/local/etc/mysql/
For Ubuntu 18.04 and mysql 5.7
step 1:sudo mkdir /var/run/mysqld;
step 2:sudo chown mysql /var/run/mysqld
step 3:sudo mysqld_safe --skip-grant-tables& quit (use quit if its stuck )
login to mysql without password
step 4:sudo mysql --user=root mysql
step 5:SELECT user,authentication_string,plugin,host FROM mysql.user;
step 6:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
now login with
- mysql -u root -p
Try it: sudo mysql_secure_installation
Work's in Ubuntu 18.04
In case someone lands here after making the same mistake I did:
- Switched to
plugin="mysql_native_password"
temporarily. Performed my tasks. - Attempted to switch back to the "auth_socket" plugin, but incorrectly referenced it as
plugin="auth_socket"
which resulted inmysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"
- Lacking a way to login to fix this mistake, I was forced to have to stop mysql and use
mysql_safe
to bypass authentication in order to switch to the appropriate pluginplugin="unix_socket"
Hopefully this saves someone some time if they receive the original poster's error message, but the true cause was flubbing the plugin name, not actually lacking the existence of the "auth_socket" plugin itself, which according to the MariaDB documentation:
In MariaDB 10.4.3 and later, the unix_socket authentication plugin is installed by default, and it is used by the 'root'@'localhost' user account by default.
You can try with the below commands:
hduser@master:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
hduser@master:~$ sudo /etc/init.d/mysql start
[ ok ] Starting mysql (via systemctl): mysql.service.
'IT박스' 카테고리의 다른 글
늘어나지 않는 android : background를 구현하는 방법은 무엇입니까? (0) | 2020.08.21 |
---|---|
누구나 Reacts 단방향 데이터 바인딩과 Angular의 양방향 데이터 바인딩의 차이점을 설명 할 수 있습니까? (0) | 2020.08.21 |
MySQL을 사용하여 세 테이블 조인 (0) | 2020.08.21 |
Android : 온라인 푸시 알림 테스트 (Google 클라우드 메시징) (0) | 2020.08.21 |
툴바 홈 아이콘 색상을 변경하는 방법 (0) | 2020.08.21 |