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.
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 an old threaded application to use the embedded library, you normally only have to add calls to the following functions.
|Function||When to Call|
|Should be called before any other MySQL function is called, preferably
early in the |
|Should be called before your program exits.|
|Should be called in each thread you create that accesses MySQL.|
|Should be called before calling |
Then you must link your code with
libmysqlclient.a. To ensure binary
compatibility between your application and the server library, be
sure to compile your application against headers for the same series
of MySQL that was used to compile the server library. For example,
libmysqld was compiled against MySQL 4.1
headers, do not compile your application against MySQL 5.1 headers,
or vice versa.
functions are also included in
to enable you to change between the embedded and the client/server
version by just linking your application with the right library. See
Section 220.127.116.11, “mysql_library_init()”.
One difference between the embedded server and the standalone server
is that for the embedded server, authentication for connections is
disabled by default. To use authentication for the embedded server,
option when you invoke configure to configure
your MySQL distribution. This option is available as of MySQL 4.1.3.