Mac 에서 mysql Access denied for user 해결 방법 을 만 났 습 니 다.

3704 단어 mysql
다음으로 전송:http://blog.csdn.net/happyaaaaaaaaaaa/article/details/51296913
저자: CodeGranker 학습
my sql 을 공부 할 때 초기 비밀 번 호 를 수정 하 는 것 에 대해 매우 골 치 아 팠 습 니 다. 그래서 인터넷 에서 자 료 를 찾 아 문 제 를 순조롭게 해결 해 주 셔 서 감사합니다.
my sql 설치 후 다음 오류 알림 이 발생 했 습 니 다:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
이것 은 my sql 이 Liux 시스템 에서 의 작은 결함 입 니 다. 루트 비밀 번 호 를 알려 주지 않 아 처음으로 로그 인 할 수 없습니다.mysql 암호 수정 에 대한 유효한 방안 을 제시 합 니 다. 이 방안 은 5.7.12 에서 직접 테스트 할 때 유효 합 니 다.
0) 사용자 디 렉 터 리 에 다음 명령 을 입력 하 십시오:
alias mysql='/usr/local/mysql/bin/mysql'  
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'  

mysql 빠 른 사용
1) mysql 서비스 중지
sudo /usr/local/mysql/support-files/mysql.server stop  

2) 안전 모드 에서 mysql 시작
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables  

3)  새 명령 창 만 들 기 (현재 창 아래 단축 키 command + N 을 눌 러 서 만 들 수 있 음):
mysql -u root 

4) 명령 창 에서 명령 을 수정 합 니 다:
mysql > UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';  

위의 명령 이 안 되면 아래 의 것 을 시도 해 보 세 요.
mysql> update mysql.user set authentication_string=password('1234') where user='root';  

mysql.user , 4) : ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql> update mysql.user set authentication_string=password('1234') where user='root';  

성공:

Query OK, 1 row affected, 1 warning (0.01 sec) Rows matched: 1  Changed: 1  Warnings: 1 5)  MySQL , " MySQL " , 。

mysql > FLUSH PRIVILEGES;  

6) 새 명령 창, 비밀번호 1234 로 다시 로그 인 시도:
mysql -uroot -p  
Enter password:  

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.12 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
이 정 보 를 보면 루트 로 my sql 에 성공 적 으로 로그 인 했 음 을 나타 낸다.

좋은 웹페이지 즐겨찾기