2014-07-25 3 views
0

새로운 데이터베이스에 문제가 있습니다. 데이터베이스에 액세스하는 유일한 f}은 SSH 터널을 _ 생시키는 것입니다. 그러나 명령 다음 ...SSH 터널을 통한 MySQL 데이터베이스 연결

제가 사용을 작동하지 않습니다

sshpass -p <PASSWORD> ssh <USER>@<DOMAIN> -p <PORT> -L 3306:localhost:3306 -f -N 

내가 SSH 터널 작품을 생각하고 설정됩니다.

이제 Shell-File을 통해 데이터베이스에 연결하고 싶습니다.

deposit=`mysql -h localhost --port=3306 -u <DATABASEUSER> --password=<DATABASEPASSWORD> --skip-column-names -e "<MYSQLSYNTAX>"` 

그러나 항상 오류가 folowing된다

ERROR 1045 (28000): Access denied for user '<DATABASEUSER>'@'localhost' (using password: YES) 

당신이 어떤 아이디어가 아니면 내가 뭔가 잘못하고있는 중이 야합니까?

대단히 감사합니다!

답변

1

모든 사용 권한이 있다고 가정하면 127.0.0.1의 경우 localhost을 바꿀 가치가 있습니다. MySQL의 문서 당으로

:

On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server.

0

난 당신이 컴퓨터와 SQL 서버를 실행중인 원격 컴퓨터 사이에 터널을 만들려고 알고있는 것처럼 http://dev.mysql.com/doc/refman/5.5/en/connecting.html. ssh 명령에서 3306 : localhost : 3306을 원격 컴퓨터 IP 주소로 대체하십시오. 원격 컴퓨터와 동일한 로컬 네트워크에 있지 않은 경우 내부 로컬 IP 주소 여야합니다. SQL 데이터베이스 권한, 사용자 이름 및 암호도 확인하십시오.

관련 문제