mysql_real_connect에 관한 질문~! ㅜ.ㅡ

kn31232의 이미지

* MYSQL* mysql_real_connect(MYSQL* mysql, const char* host, const char* user,
		const char* passwd, const char* db, uint port, const char* unix_socket, uint client_flag)

이런 구조를 가지고 있습니다..음....

다른 컴퓨터(IP 192.168.0.31이라고 가정)의 DB에 접근하고 싶을때...

connection = mysql_real_connect ( &test, "192.168.0.31", "test", "test", NULL, 3306, (char *)NULL, 0);

MYSQL connection = NULL, test; 로 선언하고....

if (connection == NULL)일떄 에러 메세지를 발생하게 하도록 하고 있는데 아래와 같은 에러가 나네요...

ERROR : Can't connect to MySQL server on '192.168.0.31' (111)

음...31번 에서는 mysql이 설치되어 있고 그쪽에서 C-Api로 잘돌아가고 있습니다.
외부에서 접근하는 방법이 저렇게 하면 안돼는 건가요? ㅜ.ㅡ

음....해결했으면 좋겠는데....저렇게 해보신적 없는지 모르겠네요...

다른것들 보면 다들 로컬로 접근하신거 밖에 없어서.....^^;

예전에 어디선가 mysql에러 메세지 번호에 따른 에러 유형을 본거같은데....

혹시 관련 자료 가지고 계신분 있으신가요? 111번 에러같은데 111번 에러가 뭔지...알아야...ㅎㅎ ^^;;

음~ 그럼 즐프하시구요~ 멋진 답글 기다리고 있겠습니당~! ㅡ0ㅡ//

mangg의 이미지

혹시,,,
mysql DB에서 그러니까...계정 DB 추가 하는 부분에서..
로컬 접속만 허용하셨는지요?

mysql 접속시 ,
외부에서 해당 계정으로 접속할수 있도록 해줘야 합니다.

-------------------
나는 Copy&Paster 이다. 나의 화려한 기술 조합에 모두들 나를 두려워 한다. 나도 코드 Maker 이고 싶다.

hurryon의 이미지

테스트로 이렇게 한번 해 보시죠.

mysql -h 192.168.0.31 -u test -p

이렇게 해서 원격에 있는 서버에 접속이 되는지 먼저 확인을 보세요. 아마도
접속이 안될거 같군요. 그러다면 test 사용자가 원격에서도 서버에 접속이
가능하게 되어있는지 확인을 해보세요.

:-)

kn31232의 이미지

계정사용자 host가 localhost로 되어 있더군요~!

외부 32번 아이피에서 접근 가능한 계정을 하나 추가했더니 잘 됩니다~! ^^

히히~ 님들 감솨요~ (___)//

飛上

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.