Go Up to Database Connectivity (FireDAC)
MySQL Workbench is a unified visual tool for database architects, developers, and DBAs. MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for server configuration, user administration, backup, and much more. MySQL Workbench is available on Windows, Linux and Mac OS X. MacOS Server, formerly Mac OS X Server and OS X Server, is a series of Unix-like server operating systems developed by Apple Inc. And based on macOS (formerly Mac OS X and OS X). MacOS Server adds server functionality and system administration tools to macOS and provides tools to manage both macOS -based computers and iOS -based devices.
Server: The TCP/IP address or host name of the server running a MySQL server. 127.0.0.1 Port: The TCP/IP port on which the MySQL server is listening. 3306 Database: Name of the current database for the connection. If the Database is not specified, no current database is set up. MyDB UserName: The MySQL user ID. Root Password: The MySQL. (mysql-8.0.22-winx64.zip) MD5: a78e5da2bb87b51b6df06690977be199 Signature Windows (x86, 64-bit), ZIP Archive Debug Binaries & Test Suite: Sep 23, 2020: 434.4M.
This topic describes how to connect to MySQL Server.
- 2Client Software
- 6Usage Cases
- 7See Also
Supported Versions
The FireDAC native driver supports:
Uninstall Mysql Server Macos
- MySQL Server Community, Enterprise, and Embedded editions version 3.21 and later
- MariaDB 5.5 and later.
Client Software
Windows Client Software
FireDAC requires one of the following libraries:
- The LIBMYSQL.DLL client library for connecting to MySQL server.
- The LIBMYSQLD.DLL embedded server library. See MySQL Embedded server later in this topic.
You can take them from a server (details) installation Bin or Lib folders and place them in:
- a folder listed in your PATH environment variable (for example, <Windows>SYSTEM32)
- your application EXE folder.
To connect to a 64-bit version of MySQL 8.0 at runtime you need:
- LIBMYSQL.DLL.
- VS2015 runtime 64-bit.
- Two libraries from MySQL MSVC++ Connectors pack of the 8.0 version:
- LIBCRYPTO-1_1-x64.DLL.
- LIBSSL-1_1-x64.DLL.
Alternatively you may put the required files in any other folder, and specify their path in FDDrivers.ini:
If the MySQL client library has not been installed properly, an exception is raised when you try to connect:
macOS Client Software
FireDAC requires:
- the libmysqlclient.dylib x86 client library.
You can download it as Connector/C for macOS (here) and extract it into /usr/local folder, using the command:
iOS Client Software
Mac Os Download For Windows
The article (more) explains how to build libmysqlclient.dylib for iOS.
Note, Embarcadero Technologies has not tested this and does not provide assistance with it.
Linux Client Software
To install the MySQL client library:
- On Ubuntu Server 16.04 LTS, run:
- On Red Hat Enterprise Linux 7, run:
Driver Linkage
To link the driver:
- drop a TFDPhysMySQLDriverLink component from the 'FireDAC Links' component palette page
- or include the FireDAC.Phys.MySQL unit in the uses clause.
Connection Definition Parameters
To connect to a MySQL DBMS, most applications require that you specify DriverID, Server, Database, User_Name, Password, and CharacterSet (see Defining Connection (FireDAC) for details).
DriverID=MySQL
Parameter | Description | Example value |
---|---|---|
Server | The TCP/IP address or host name of the server running a MySQL server. | 127.0.0.1 |
Port | The TCP/IP port on which the MySQL server is listening. | 3306 |
Database | Name of the current database for the connection. If the Database is not specified, no current database is set up. | MyDB |
User_Name | The MySQL user ID. | root |
Password | The MySQL user password. | |
CharacterSet | The default character set for the connection. The connection collation becomes the default collation of the character set. For details, see the SET NAMES statement. | cp1251 |
Compress | Specify True to enable network traffic compression. By default, it is set to False. | |
UseSSL | Specify True to enable SSL connection. By default, it is set to False. Setting UseSSL=True requires you to additionally specify the connection definition parameters:
For additional details, see the MySQL Documentation: | True |
LoginTimeout | Controls the amount of time, in seconds, before an application times out while attempting to establish a connection. | 30 |
ReadTimeout | The time-out in seconds for attempts to read from the server. Each attempt uses this time-out value and there are retrials if necessary, so the total effective time-out value is three times the option value. You can set the value so that a lost connection can be detected earlier than the TCP/IP Close_Wait_Timeout value of 10 minutes. This option works only for TCP/IP connections and, prior to MySQL 5.1.12, only for Windows. By default, it is not set. | 5 |
WriteTimeout | The time-out in seconds for attempts to write to the server. Each attempt uses this time-out value and there are net_retry_count retrials if necessary, so the total effective time-out value is net_retry_count times the option value. This option works only for TCP/IP connections and, prior to MySQL 5.1.12, only for Windows. By default, it is not set. | 5 |
ResultMode | Controls the fetching of a result set to a client. The default value is Store.
| Use |
TinyIntFormat | Controls the TINYINT(1) representation. The default value is Boolean.
| Integer |
MetaDefCatalog | Default database name. The Design time code excludes the catalog name from the object name if it is equal to MetaDefCatalog. Setting the MetaDefCatalog does not change the current database in the MySQL session. | MyDB |
MySQL Embedded Server
Important:
- All path argument values use Unix backslashes. You can specify paths relatively to the application EXE folder, which simplifies the deployment.
- libmysqld.dll and errmsg.sys must be of the same version.
- libmysqld.dll v 5.1.34, as probably some other versions, are broken and do not work. Update to other version.
- The general MySQL Embedded setup may be hard. For simplified setup, see examples later.
- In case of incorrect arguments for libmysqld.dll initialization, the application may silently terminate.
To prepare your application to work with a MySQL Embedded server, you should take the following actions:
- Include the TFDPhysMySQLDriverLink component in your application. Note that 'add argument' means 'add argument to TFDPhysMySQLDriverLink.EmbeddedArgs list'. Optionally you can use the driver configuration file.
- Copy LIBMYSQLD.DLL to the application executable folder. If this folder differs from the application executable folder, add the --basedir=<LIBMYSQLD folder> argument and set TADPhysMySQLDriverLink.VendorLib to <LIBMYSQLD folder>LIBMYSQLD.DLL.
- If only English messages are used, copy shareenglisherrmsg.sys to <LIBMYSQLD folder> and add the --language=<LIBMYSQLD folder> argument. If multiple language messages are used, copy the appropriate folders from share* to <LIBMYSQLD folder>, preserving the directory structure. There is no need to add the --language argument, because <LIBMYSQLD folder>share* is the default location.
- If the used character sets are different from ASCII, copy shareenglishcharsets to <LIBMYSQLD folder>, preserving the directory structure. There is no need to add the --character-sets-dir argument, because <LIBMYSQLD folder>sharecharsets is the default location.
- If the database files are located in different folders than <LIBMYSQLD folder>, add the --datadir=<database files folder> argument. With 5.6.11 it is required to specify this argument.
- If the InnoDB engine is not used, add the --skip-innodb argument. Otherwise, add the --innodb_data_home_dir=<database files folder> argument, where the value is the InnoDB data space directory.
- If your application does not connect to a remote MySQL server, add the --skip-networking argument.
- If your application uses an external settings file, add the --defaults-file=my.ini argument.
- If your application uses MySQL plugins, add the --plugin_dir=<plugin folder> argument. Normally, plugins are located in <LIBMYSQLD folder>libplugin.
- Add appropriate arguments to tune performance.
To connect to the MySQL Embedded server, you do not need to specify Server, Host, Port, User_Name, Password connection definition parameters. If you do not specify the --skip-networking argument, then using libmysqld.dll you can connect to the remote MySQL servers, the same as with normal libmysql.dll.
Simple setup example:
- Charsets: ASCII only
- Messages: English only
- Database: the EXE folder
Extended setup example:
- Charsets: multiple
- Messages: multiple
- Database: 'data' subfolder
Mysql Server Macos Server
Usage Cases
Using a Secure Connection
To use TLS/SSL encryption, define the UseSSL parameter with True
as value and then specify the SSL_key, SSL_cert, and SSL_ca parameters as follows:
You may also use the SSL_capath and SSL_cipher parameters, see the UseSSL entry in the Connection Definition Parameters table above for more information.

- Note: You can also use the
my.cnf
configuration file.


Other Usage Cases
- Connect to a locally running server, listening on the default (3306) port:
- Connect to a remote server, listening on a non-default port, using Unicode for character data:
- Connect to an embedded server, using Unicode for character data:
See Also
Samples
- FireDAC MySQL sample
