Spec-Zone.ru › MySQL 5.7

27.6 libmysqld, the Embedded MySQL Server Library

  • 27.6.1 Compiling Programs with libmysqld
  • 27.6.2 Restrictions When Using the Embedded MySQL Server
  • 27.6.3 Options with the Embedded Server
  • 27.6.4 Embedded Server Examples

The embedded MySQL server library makes it possible to run a full-featured MySQL server inside a client application. The main benefits are increased speed and more simple management for embedded applications.

Note

The libmysqld embedded server library is deprecated as of MySQL 5.7.19 and is removed in MySQL 8.0.

The embedded server library is based on the client/server version of MySQL, which is written in C/C++. Consequently, the embedded server also is written in C/C++. There is no embedded server available in other languages.

The API is identical for the embedded MySQL version and the client/server version. To change a threaded application to use the embedded library, you normally only have to add calls to the following functions.

Table 27.2 MySQL Embedded Server Library Functions

Table 27.2 MySQL Embedded Server Library Functions

Function

When to Call

Call it before any other MySQL function is called, preferably early in the main() function.

Call it before your program exits.

Call it in each thread you create that accesses MySQL.

Call it before calling pthread_exit().

Then, link your code with libmysqld.a instead of libmysqlclient.a. To ensure binary compatibility between your application and the server library, always compile your application against headers for the same series of MySQL that was used to compile the server library. For example, if libmysqld was compiled against MySQL 5.6 headers, do not compile your application against MySQL 5.7 headers, or vice versa.

Because the mysql_library_xxx() functions are also included in libmysqlclient.a, you can change between the embedded and the client/server version by just linking your application with the right library. See .

One difference between the embedded server and the standalone server is that for the embedded server, authentication for connections is disabled by default.

© 2025 Oracle
Licensed under the GPLv2 License.
https://docs.oracle.com/cd/E17952_01/mysql-5.7-en/libmysqld.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API