Ubuntu12.04 unixodbc mysql5.5 connection

first,sorry I can't type chinese....


To install unixodbc for mysql under ubuntu12.04 ,follow this steps:

1.install mysql.

apt-get install mysql-server

apt-get install mysql-client

(my version is 5.5)


2.

  1)first : apt-get install unixodbc  

                apt-get install unixodbc-dev

                apt-get install unixodbc-bin

                apt-get install libmyodbc

(attention:just for install necessary lib.)


  2)download unixodbc,attention.

     you can download it from website:http://www.unixodbc.org/

    (my version is unixODBC-2.2.1 )

    install unixODBC.

    . /configure  

     make

     make install

(attention: step 2 is not necessary,only need when some command is not exists...just for install some commond ,for example isql.)


3.download mysql-connector-odbc-5.1.12-linux-debian6.0-x86-64bit.tar.gz

(attention: your platform is x86 or 64bit ,you should choose. and you should choose 5.1.12 version,others can't work as the result of my test.)

you can download it from http://ftp.ntu.edu.tw/pub/MySQL/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.12-linux-debian6.0-x86-64bit.tar.gz

(这里是64位还是32位根据自己cpu决定。)


4.add mysql-odbc driver  and add data source.

(attention:this step must use step 3 tools.)

1.)

    tar -zxvf mysql-connector-odbc-5.1.12-linux-debian6.0-x86-64bit.tar.gz

     cd mysql-connector-odbc-5.1.12-linux-debian6.0-x86-64bit

     cd lib

    cp libmyodbc5.so    /usr/lib/

2.)cd  ../bin

     ./myodbc-installer --help

      flow the step :(UNIX example)

            Resiter a driver  ,   Add a new data source name

            (attention :UID  means username,for example root, not number 0)

3.)odbcinst -j

     check :   DRIVERS......                                     /etc/odbcinst.ini    (necessary)

                     SYSTEM DATA SOURCES:            /etc/odbc.ini           (necessary)

                     USER DATA SOURCES........         /root/.odbc.ini         (option)


5.test step...

 isql -v 

unixODBC MySQL ODBC5.1 Driver Can't connect to local MySQL server through socket

'/tmp/mysql.sock'


solved by:
cat /etc/mysql/my.cnf

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock


ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值