当前位置:网站首页>MATLAB与Mysql数据库连接并数据交换(基于ODBC)
MATLAB与Mysql数据库连接并数据交换(基于ODBC)
2022-06-26 21:23:00 【宝筝梦中声】
一、配置ODBC数据源
1.1、安装Mysql-connect-ODBC驱动,点击mysql-connector-odbc-5.2.5-winx64.msi

1.2、点击下一步NexT

1.3、选择:I accept the terms in the license agreement

1.4、选择 Typical,下一步Next


1.5、ODBC驱动安装完毕
二、在控制面板中点击“管理工具”

2.1、选择64位ODBC数据源
设置ODBC数据源时,可以指定用户数据源名称(DSN)或系统DSN。用户DSN是特定于登录到计算机的人。只有这个人才能看到在用户DSN选项卡上定义的数据源。系统DSN并不是特定于登录到计算机的人。任何登录到机器的人都可以看到在SystemDSN选项卡上定义的数据源。您设置用户DSN或系统DSN的能力取决于所使用的数据库和ODBC驱动程序。有关详细信息,请与数据库管理员联系或参考ODBC驱动程序文档。

2.2、点击添加

2.3、选择“MySQL ODBC 8.0 Unicode Driver”

2.4、填写数据库信息,Data Source Name是数据库名称;Description是描述,可不填写;
TCP/IP Server可以填localhost或127.0.0.1;User为用户名,默认为root;Password为密码,为安装MySQL时所填写的密码;然后点击Test,提示connect successful,即成功。然后点击OK。
- 在数据源名称框中,输入数据源的适当名称,如MySQL。使用此名称可建立到数据库的连接。
- 在描述框中,输入此数据源的说明,如MySQL database.
- 在TCP/IP服务器框中,输入数据库服务器的名称。有关数据库服务器的名称,请咨询数据库管理员。
- 在港框中输入端口号。默认端口号为3306.
- 在用户框中,输入您的用户名。
- 在密码框中输入您的密码。
- 在数据库框中,输入数据库的名称。

2.5、配置完成。

三、在matlab中进行操作
3.1、打开MATLAB,在APP中选择Database Explorer;
通过单击MATLAB工具条上的Apps选项卡打开数据库资源管理器应用程序。然后,在“应用程序”部分的右侧,单击“显示更多”箭头,打开应用程序库。在“数据库连接和报告”下,单击“数据库资源管理器”。或者,在命令行输入DatabaseExplorer。在“数据源”部分中,选择“配置数据源>配置ODBC数据源”。

3.2、在弹窗中选择建好的数据库,输入用户名及密码,点击connect;

3.3、连接成功为下图

3.4、在命令行中输入代码,得到数据,如下图;
连接到MySQL使用ODBC驱动程序和命令行
使用ODBC数据源名称连接到数据库。例如,此代码假定您正在连接到名为MySQL具有用户名username和密码pwd.
conn = database('MySQL','username','pwd');闭数据库连接。
close(conn)

边栏推荐
- 这些地区考研太疯狂!哪个地区报考人数最多?
- [Shandong University] information sharing for the first and second examinations of postgraduate entrance examination
- C language 99 multiplication table
- 诗尼曼家居冲刺A股:年营收近12亿 红星美凯龙与居然之家是股东
- BN(Batch Normalization) 的理论理解以及在tf.keras中的实际应用和总结
- Gee: calculate the maximum and minimum values of pixels in the image area
- C language simple login
- Leetcode question brushing: String 05 (Sword finger offer 58 - ii. left rotation string)
- API管理之利剑 -- Eolink
- [serial] shuotou O & M monitoring system 01 overview of monitoring system
猜你喜欢

Leetcode: hash table 08 (sum of four numbers)

VB.net类库(进阶版——1)

GameFi 活跃用户、交易量、融资额、新项目持续性下滑,Axie、StepN 能摆脱死亡螺旋吗?链游路在何方?

分布式ID生成系统

The latest 2022 research review of "continuous learning, CL"
![[Bayesian classification 2] naive Bayesian classifier](/img/44/dbff297e536508a7c18b76b21db90a.png)
[Bayesian classification 2] naive Bayesian classifier

宝藏又小众的覆盖物PBR多通道贴图素材网站分享

Vi/vim editor

Netease Yunxin officially joined the smart hospital branch of China Medical Equipment Association to accelerate the construction of smart hospitals across the country

VB.net类库,获取屏幕内鼠标下的颜色(进阶——3)
随机推荐
回首望月
股票炒股注册开户有没有什么风险?安全吗?
花店橱窗布置【动态规划】
Shiniman household sprint A shares: annual revenue of nearly 1.2 billion red star Macalline and incredibly home are shareholders
慕课8、服务容错-Sentinel
Is there any risk in registering and opening an account for stock speculation? Is it safe?
0 basic C language (2)
VB.net类库(进阶——2 重载)
How to analyze financial expenses
y48.第三章 Kubernetes从入门到精通 -- Pod的状态和探针(二一)
与 MySQL 建立连接
网易云信正式加入中国医学装备协会智慧医院分会,为全国智慧医院建设加速...
Gee: calculate the maximum and minimum values of pixels in the image area
PostgreSQL notes
DLA模型(分类模型+改进版分割模型) + 可变形卷积
The source code that everyone can understand (I) the overall architecture of ahooks
云计算技术的发展与芯片处理器的关系
【山东大学】考研初试复试资料分享
【protobuf 】protobuf 昇級後帶來的一些坑
宝藏又小众的覆盖物PBR多通道贴图素材网站分享