Linux MYSQL ODBC 설치

in mysql •  6 years ago  (edited)

Linux MYSQL ODBC 설치

  1. MYSQL ODBC 다운로드
  2. 설치
  3. 확인

mysql odbc 다운로드

http://dev.mysql.com/downloads/connector/odbc/


링크주소 복사후 리눅스 터미널에서 다운로드 압축 해지

cd /tmp
wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.12-linux-glibc2.12-x86-64bit.tar.gz
tar xvfz mysql-connector-odbc-8.0.12-linux-glibc2.12-x86-64bit.tar.gz

myodbc-installer

   cp /tmp/mysql-connector-odbc-5.3.6-linux-glibc2.5-x86-64bit/bin/* /usr/local/bin
   cp /tmp/mysql-connector-odbc-5.3.6-linux-glibc2.5-x86-64bit/lib/* /usr/local/lib

   myodbc-installer -a -d -n "MySQL ODBC 5.2 Driver" -t "Driver=/usr/local/lib/libmyodbc5w.so"

설치 진행중 오류 발생시 unixodbc 설치 하시면 됩니다.

error

   myodbc-installer: error while loading shared libraries: libodbc.so.2: cannot open shared object file: No such file or directoryapt-cache search libodbc.so.2

unixodbc 설치
http://www.unixodbc.org

다운로드

   cd /tmp
    wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.4.tar.gz
     tar xvfz unixODBC-2.3.4.tar.gz 

make

    cd /tmp/unixODBC-2.3.4/
    ./configure
    make 
    mkdir /usr/local/unixODBC
    make prefix=/usr/local/unixODBC install

    cp /usr/local/unixODBC/bin/* /usr/local/bin 
    cp /usr/local/unixODBC/lib/* /usr/local/lib 

Comm library 확인

   ldconfig -p | grep libodbc.so.2

공유라이브러리 관리 명령어

ldconfig : 기본 공유라이브러리의 위치 /usr/lib,/lib 를 /etc/ld.so.conf에 등록 된 디렉토리 및 지정된 위치를 추가해서
/etc/ld.so.cache 파일을 업데이트 한다. Linux 의 모듈파일(*.so)을 제대로 인식하지 못할때 다시 읽어 들이는 명령

Comm library 등록

  ldconfig -v 
  ldconfig -p | grep libodbc.so.2
  libodbc.so.2 (libc6,x86-64) => /usr/local/lib/libodbc.so.2 

ODBC Manager Drive 등록

 myodbc-installer -a -d -n "MySQL ODBC 5.2 Driver" -t "Driver=/usr/local/lib/libmyodbc5w.so"
 Success: Usage count is 1
 
 root@devdb-mysql02:/usr/local/unixODBC/lib# myodbc-installer -d -l
 MySQL ODBC 5.2 Driver 

ODBC Manager datasource 등록

 myodbc-installer -s -a -c2 -n "test" -t "DRIVER=MySQL ODBC 5.3      Driver;SERVER=localhost;DATABASE=dba;UID=xxx;PWD=xx x;port=13306;Socket=/database/log/test_mysql02.sock"
 
 myodbc-installer -s -l
 test                 - MySQL ODBC 5.3 Driver

ODBC로 MYSQL 접속 테스트

 isql  test uid 'pwd' 

 +---------------------------------------+
 | Connected!                            |
 |                                       |
 | sql-statement                         |
 | help [tablename]                      |
 | quit                                  |
 |                                       |
 +---------------------------------------+
 
 SQL> select @@hostname
 +--------------+
 | @@hostname   |
 +--------------+
 | devdb-mysql02|
 +--------------+
 SQLRowCount returns 1
 1 rows fetched
 SQL>
  • 주의할점
    " /usr/local/etc/odbc.ini 파일의 패스워드 ' or '' 묶으면 안됨 "
    Pwd: 'xxx' 오류 발생
    Pwd: xxx 사용해야 됩니다.


odbc 정보 설정 예 (/usr/local/etc/odbc.ini )

  Name:                test
  Driver:              MySQL ODBC 5.3 Driver
  Server:              localhost
  Uid:                 xxx
  Pwd:                 xxx
  Database:            dba
  Socket:              /database/log/test_mysql.sock
  Port:                3306

기타

  apt-file search xxxx. 
  apt-cache show xxxx
  apt --installed list 
  apt-get install gcc
  apt-get remove --purge unixodbc
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @jaerakson! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard and the Veterans on Steemit - The First Community Badge.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!