2015-01-22 2 views
2
C:\Users\dp\Desktop>mysql -u user -pXXXX -h 127.0.0.1 -P 3306 
Warning: Using a password on the command line interface can be insecure. 
ERROR 1045 (28000): Access denied for user 'mywayuser'@'localhost' (using passwo 
rd: YES) 

C:\Users\dp\Desktop>mysql -u user -pXXXX -h localhost -P 3306 
Warning: Using a password on the command line interface can be insecure. 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 14 
Server version: 5.6.21-log MySQL Community Server (GPL) 

Copyright (c) 2000, 2014, 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. 

mysql> exit 

나는 이미 127.0.0.1에 대해 모든 특권을 부여했습니다.mysql 127.0.0.1에 연결할 수 없지만 로컬 호스트에 연결할 수 있음

내가 뭘 잘못하고 있니?

답변

2

[email protected][email protected]은 MySql에서 다른 자격 증명입니다. MySQL의 경우 localhost 호스트는 기본적으로 "IP가 아닌 소켓을 통해 연결"됩니다.

, 당신은 mysql 데이터베이스에서 user 테이블에 localhost에서 원하는 사용자를 위해 특별히 항목이 필요 당신이 노력하고 같은 소켓을 통해 localhost로 명시 적으로 연결하기 :

CREATE USER 'user'@'localhost' IDENTIFIED BY PASSWORD 'xxxxx'; 

에도 캐치 모든 "% "작동하지 않습니다. 원한다면 localhost 항목이 있어야합니다. 그런 다음이 사용자에게 권한을 부여하십시오.

아니면 MySQL은 로컬 호스트 취급이 마음에 들지 않은 경우 내가 선호하는 것의 IP 127.0.0.1 또는 특별한 호스트 localhost

mysql -u user -pXXXX -h 127.0.0.1 -P 3306 

네보다 127.0.0.1에 다른 매핑 다른 호스트 이름을 사용하여 연결할 수 있습니다, 하지만 거기에 ...

관련 문제