DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: laidabin
今日帖子: 1
在线用户: 9
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 15:20:20
标题:
请教:Delphi 如果连接 MySQL 数据库? 浏览:2269
加入我的收藏
楼主: 安装 MySQL 8.0.25 (https://dev.mysql.com/downloads/mysql/)成功。

Delphi 如何连接这个数据库?
用各种工具软件(sqlyog、Navicat Premium 12)测..试连接都失败了。
此帖子包含附件:
PNG 图像
大小:60.2K
----------------------------------------------
武汉天气不好
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 15:28:32
1楼: sqlyog 错误截图:
此帖子包含附件:
PNG 图像
大小:366.7K
----------------------------------------------
武汉天气不好
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 15:47:29
2楼: 用 FireDAC 连接也报错。

  object con1: TFDConnection
    Params.Strings = (
      'DriverID=MySQL'
      'User_Name=root'
      'Password=xxxx')
    Left = 208
    Top = 24
  end
此帖子包含附件:
PNG 图像
大小:9.2K
----------------------------------------------
武汉天气不好
作者:
男 xiaoxingliang1 (xiaoxingliang1) ★☆☆☆☆ -
普通会员
2021/10/11 15:55:44
3楼: uniDac可以直连
----------------------------------------------
-
作者:
男 redhan (晓寒) ★☆☆☆☆ -
盒子活跃会员
2021/10/11 16:23:13
4楼: FireDAC 
把 mysql 里的 libmysql.dll 复制到自己程序下
----------------------------------------------
-
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 16:25:26
4楼: 我从官网 https://www.devart.com/unidac/download.html
下载了 UniDAC 9.0 for RAD Studio 11 Alexandria,安装测..试了一下。

的确可以直连。但试用版需要带包编译。有源码版本的 for Delphi 11 吗?

有谁可以提供一下吗?

谢谢了。
----------------------------------------------
武汉天气不好
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 16:34:45
5楼: @redhan,
  测..试了一下 X64 版本,把 libmysql.dll(X64), 复制到程序目录下(X64)。
  测..试不通过。错误和上面相同。

  MySQL 是 X64 版本。测..试程序分 X86、X64 版本吧?
----------------------------------------------
武汉天气不好
作者:
男 iamdream (银河恒久远,梦想无止境!) ★☆☆☆☆ -
大贡献会员
2021/10/11 20:53:17
6楼: DLL是64位,那么你的程序需要编译成64位,否则你需要找到32位的libmysql.dll。
----------------------------------------------
-广袤璀璨的银河,永无止境的梦想(梦无止境游银河) 博客挂了……
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/10/11 21:15:14
7楼: try this:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 441
  ClientWidth = 624
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -12
  Font.Name = 'Segoe UI'
  Font.Style = []
  PixelsPerInch = 96
  TextHeight = 15
  object FDConnection1: TFDConnection
    Params.Strings = (
      'Database=YOUR_DATABASE_FILE'
      'User_Name=USER_NAME'
      'Password=PASSWORD'
      'DriverID=MySQL')
    Left = 256
    Top = 208
  end
  object FDPhysMySQLDriverLink1: TFDPhysMySQLDriverLink
    VendorLib = 'c:\DIrectoryDLL\DLL_Name.DLL'
    Left = 416
    Top = 208
  end
  object FDGUIxWaitCursor1: TFDGUIxWaitCursor
    Provider = 'Forms'
    Left = 368
    Top = 120
  end
end
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/11 21:53:22
8楼: @iamdream: 
  官网也没有X86版本呀。
  如果测..试程序有x86/x64两个版本,需要安装 mysql x86/x64 两个版本吗?

@emailx45:
  test program is x64, mysql is x64.
  as you said, error:
此帖子包含附件:
PNG 图像
大小:10.7K
----------------------------------------------
武汉天气不好
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2021/10/12 0:07:17
9楼: --->  Visual C++ Redistributable for Visual Studio is missing. 
While you should of course first make sure that the library can be found (e.g. by placing it into the same directory as your executable), the usual reason for this problem is that the Visual C++ Redistributable for Visual Studio is missing. It is a prerequirement for libmysql.dll and the MySQL server itself (and a lot of other software), and you need to install this package on the target system.

https://www.microsoft.com/en-US/download/details.aspx?id=48145

----> Library MySQL
It is a prerequirement for libmysql.dll and the MySQL server itself (and a lot of other software), and you need to install this package on the target system.

----> by Embarcadero
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Connect_to_MySQL_Server_(FireDAC)

FireDAC requires one of the following libraries:

1) The LIBMYSQL.DLL client library for connecting to MySQL server.
2) The LIBMYSQLD.DLL embedded server library. See MySQL Embedded server later in this topic.
3) You can take them from a server (details) installation Bin or Lib folders and place them in:
4) a folder listed in your PATH environment variable (for example, <Windows>\SYSTEM32) your application EXE folder. 
5) To connect to a 64-bit version of MySQL 8.0 at runtime you need:
...a) LIBMYSQL.DLL.
...b) VS2015 runtime 64-bit.
...c) Two libraries from MySQL MSVC++ Connectors pack of the 8.0 version:
...d) LIBCRYPTO-1_1-x64.DLL.
...e) LIBSSL-1_1-x64.DLL.
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 wg961423 (麦子仲肥) ★☆☆☆☆ -
盒子活跃会员
2021/10/12 9:06:02
10楼: @dbyoung DLL只和你开发的程序位数(32或64)有关,和MySQL服务器的位数无关,你的程序是32位的,就要用32位的dll。

另外,官方实际是有32位的dll的,我以前下载过的,不过不是直接下载的,而是从官方的安装器上下载了一个32位的驱动里找出来的。
----------------------------------------------
-
作者:
男 xiaoxingliang1 (xiaoxingliang1) ★☆☆☆☆ -
普通会员
2021/10/12 9:06:12
10楼: uniDac有很多源码版呀
----------------------------------------------
-
作者:
男 wg961423 (麦子仲肥) ★☆☆☆☆ -
盒子活跃会员
2021/10/12 9:07:42
11楼: 至于你说sqlyog、Navicat Premium 12都不能连接,应该是你用的版本比较老导致的
----------------------------------------------
-
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/12 11:58:55
12楼: 谢谢各位!

用 uniDAC 搞定了。
----------------------------------------------
武汉天气不好
作者:
男 xiaobaosoft (小宝软件) ▲▲△△△ -
普通会员
2021/10/12 12:57:19
13楼: mysql8吧

把密码加密方式改回老版本模式就可以了
----------------------------------------------
-
作者:
男 earthsbest (全能中间件) ▲▲▲▲△ -
普通会员
2021/10/20 13:58:16
14楼: MySQL8只有64位的libmysql.dll了,Delphi设计期无法连接MySQL8了,因为Delphi IDE是 32 位的,exe 编译成64位就可以了。
----------------------------------------------
Delphi4Linux Delphi三层/FireDAC 技术群:734515869 http://www.cnblogs.com/rtcmw
作者:
男 keymark (嬲) ▲▲▲△△ -
普通会员
2021/10/20 16:29:49
15楼: 原来如此mark下。
----------------------------------------------
[alias]  co = clone --recurse-submodules  up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
作者:
男 kentty (kentty) ★☆☆☆☆ -
普通会员
2021/10/20 16:41:31
16楼: mysql网站上有旧版的C-Connector, 我发个链接吧,6.1.11版本的,32/64位都有
https://downloads.mysql.com/archives/c-c/
著名的HediSQL用的也是这个版本,
----------------------------------------------
-
作者:
男 dbyoung (dbyoung) ★☆☆☆☆ -
普通会员
2021/10/20 17:24:55
16楼: HeidiSQL 使用 FireDAC,可以正确连接 MySql8。而且支持 x86、x64 模式。可以参考。

源码:https://github.com/HeidiSQL/HeidiSQL.git
----------------------------------------------
武汉天气不好
作者:
男 littlestone08 (littlestone08) ★☆☆☆☆ -
普通会员
2021/12/11 12:30:00
17楼: 同样的问题,我前些天遇到了,解决方法如下:。
原因是MYSQL8只有64位,你需要下载MYSQL5,里面有32位的驱动,
因为DELPHI开发环境是32位的,要想在IDE下面用,只能使用32位驱动,使用方法见7楼

但是你要编译成64位脱离IDEA,程序直接用,应该可以使用64位驱动。
----------------------------------------------
我和我追逐的梦,擦肩而过
作者:
男 stacker (OOP才是王道) ★☆☆☆☆ -
普通会员
2021/12/11 18:36:18
18楼: 使用UniDAC可以直连,还支持跨平台,我不相信你可以在安卓或IOS上面使用DLL吧。
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行1677.734毫秒 RSS