MySQL ODBC driver installation

Source: Internet
Author: User
Tags odbc mysql create postgresql mysql odbc driver

First, online installation 1,Yum install drivers online
Yum Install  Yuminstall MYSQL-CONNECTOR-ODBC
2. Configuration Driver

(1) Viewing driver-related information

cat /etc//************************************************# Example Driver definitions# Driver from the Postgresql-odbc package# Setup from the UnixODBC package[postgresql]description = ODBC for Po Stgresqldriver =/usr/lib/psqlodbc.sosetup =/usr/lib/libodbcpsqls.sodriver64 =/usr/lib64/psqlodbc.sosetup64 =/usr/ Lib64/libodbcpsqls.sofileusage = Driver from the Mysql-connector-odbc package# Setup from the UnixODBC package[mysql]de Scription = ODBC for mysqldriver =/usr/lib/libmyodbc5.sosetup =/usr/lib/libodbcmys.sodriver64 =/usr/lib64/ LIBMYODBC5.SOSETUP64 =/usr/lib64/libodbcmys.sofileusage = 1*********************************************** */

(2) Configure MySQL Driver

cat /etc/odbc.ini #添加如下信息/ ************************************************[ Mysql-hr]driver =/usr/lib64/libmyodbc5.so #注意驱动程序的选择Description = MyODBC 5 Driver SERVER = 192.168.235.140    # Database information to connect port = 3306USER = Rootpassword = Rootdatabase = Hroption = 3charset=utf8*************************************** *********/
3. Test Connection

(1) Connect MySQL Create test user, test library

Mysql> Grant all privileges on * * to [email protected]192.168. 152.129 " Root " With Grant Option;mysql> CREATE DATABASE hr;

# #注: Configure the host to be consistent with the corresponding MySQL ODBC driver, such as IP or localhost

(2) Test connection

# isql MYSQL-HR Test root-v # #语法: isql data source name User name password option +---------------------------------------+| connected! | | || sql-statement | | Help [TableName] | | Quit | | |+---------------------------------------+SQL>
Second, compile and install

Compile installation note to pre-install the build tool, uninstall the default installed driver and select the appropriate version.

1. mysql Create test user and test library
Mysql> Grant all privileges on * * to [email protected]192.168. 152.129 " Root " With Grant Option;mysql> CREATE DATABASE test;

# #注: Configure the host to be consistent with the corresponding MySQL ODBC driver, such as IP or localhost

2. Installation drive
Yum-YInstall GCC GCC-c++ Makewgethttp//www.unixodbc.org/unixODBC-2.3.4.tar.gzwgetHttps//cdn.mysql.com//downloads/connector-odbc/5.3/mysql-connector-odbc-5.3.9-linux-glibc2.12-x86-64bit.tar.gzTar-ZXVF unixodbc-2.3.4.Tar. gz-c/usr/LocalTar-ZXVF mysql-connector-odbc-5.3.9-LINUX-GLIBC2. A-x86-64bit.Tar. gz-c/usr/local/CD/usr/local/unixodbc-2.3.4/./configure--prefix=/usr/local/unixodbc-2.3.4--includedir=/usr/include--libdir=/usr/local/lib-bindir=/usr/bin--sysconfdir=/usr/local/etc Make&& Make Install

Edit/etc/ld.so.conf

cat /etc/ldldSO.CONF.D/*Confecho "/usr/local/lib" >>/ Etc/ld.so.confldconfig

Purpose: Resolve errors./myodbc-installer:error while loading shared libraries:libodbc.so.2:cannot open shared object File:no such fi Le or directory

Registration driver

# ln -s/usr/local/mysql-connector-odbc-5.3. 9/lib/libmyodbc5a.so/usr/lib/libmyodbc5a.so#/usr/local/mysql-connector-odbc-5.3. 9 " MySQL ODBC 5.3.9 Driver " " driver=/usr/lib/libmyodbc5a.so; setup=/usr/lib/libmyodbc5a.so"
3. Configuration Driver

The contents are as follows:

[mysql-=/usr/lib/5192.168. 152.129   3306== = 3charset =utf8
4. Testing
# isql MYSQL-HR Test root-v # #语法: isql data source name User name password option +---------------------------------------+| connected! | | || sql-statement | | Help [TableName] | | Quit | | |+---------------------------------------+SQL>

Reference:

Http://www.unixodbc.org/download.html
Https://www.kysq.com/article/6e4a06c9f5.html

MySQL ODBC driver installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.