deepin安装配置mysql odbc connector

安装odbcconnector

apt install unixodbc php7.2-odbc
php的odbc也要打开设置好
mysql-connector安装
下载mysql-connector
解压缩
用管理员权限
shell> cp bin/* /usr/local/bin
shell> cp lib/* /usr/local/lib
根据需要选择unicode或者ansi
// Registers the Unicode driver:
shell> myodbc-installer -a -d -n “MySQL ODBC 8.0 Driver” -t “Driver=/usr/local/lib/libmyodbc8w.so”

// Registers the ANSI driver
shell> myodbc-installer -a -d -n “MySQL ODBC 8.0” -t “Driver=/usr/local/lib/libmyodbc8a.so”
验证一下shell> myodbc-installer -d -l
/etc/odbc.ini
[Database-connector]
Description = MYSQL connection to ‘Database’ database
Driver = MySQL ODBC 8.0 Driver
Database = Datebase
Server = localhost
UserName = username
Password = usenamepasswords
Port = 3306
Charset =utf8
/etc/odbcinst.ini
[MySQL]
Description=ODBC for MySQL
Driver=/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage=1

[MySQL ODBC 8.0 Driver]
Driver=/usr/local/lib/libmyodbc8w.so
UsageCount=1

isql命令


  • unixODBC - isql *

  • Syntax *
  •                                        *
    
  •  isql DSN [UID [PWD]] [options]        *
    
  •                                        *
    
  • Options *
  •                                        *
    
  • -b batch.(no prompting etc) *
  • -dx delimit columns with x *
  • -x0xXX delimit columns with XX, where *
  •        x is in hex, ie 0x09 is tab     *
    
  • -w wrap results in an HTML table *
  • -c column names on first row. *
  •        (only used when -d)             *
    
  • -mn limit column display width to n *
  • -v verbose. *
  • -lx set locale to x *
  • -q wrap char fields in dquotes *
  • -3 Use ODBC 3 calls *
  • -n Use new line processing *
  • -e Use SQLExecDirect not Prepare *
  • -k Use SQLDriverConnect *
  • -L Length of col display (def:300) *
  • –version version *
  •                                        *
    
  • Commands *
  •                                        *
    
  • help - list tables *
  • help table - list columns in table *
  • help help - list all help options *
  •                                        *
    
  • Examples *
  •                                        *
    
  •  isql WebDB MyID MyPWD -w < My.sql     *
    
  •                                        *
    
  •  Each line in My.sql must contain      *
    
  •  exactly 1 SQL command except for the  *
    
  •  last line which must be blank (unless *
    
  •  -n option specified).                 *
    
  •                                        *
    
  • Please visit; *
  •                                        *
    
  •  http://www.unixodbc.org               *
    
  •  nick@lurcher.org                      *
    
  •  pharvey@codebydesign.com              *
    

用isql测试
isql Database-connector username -v
±--------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
±--------------------------------------+
SQL>
如果用isql DSN -v不加用户的话,会报错,默认是你当前用户
[S1000][unixODBC][MySQL][ODBC 8.0(w) Driver]Access denied for user ‘你的当前用户名’@‘localhost’ (using password: YES)
[ISQL]ERROR: Could not SQLConnect
不知道为什么不认odbc.ini配置里面的用户名跟密码,我现在还没搞懂。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值