MySQL 8.0 – Welcome to the DevAPI!


By now you’ve read Mike Frank’s excellent introduction to the MySQL 8.0 release and it’s Document Store.  In that post Mike laid out the benefits of the new Document Store model and briefly outlined the different components involved.  While it’s fair to consider the Document Store as the first pillar of the new MySQL 8 Document story, we must identify the X DevAPI to be the second.  The post covers our motivation, goals, and overall design principles of this new API.


Most of our connectors have not implemented their own API.  Rather, most of them implement externally defined interfaces.   Examples include our Connector/J that implements the JDBC standard, Connector/Net that implements the ADO.Net standard, and our Connector/ODBC.  None of these standards work well for a document-oriented database.  In fact, there really are no defined standard APIs for document databases.  Therefore we knew we needed to develop a new API for our users.

Another reason why we needed a new API is because we are doing something that has not been done before.  Document databases exist.  Relational databases exist.  We even see databases that support relational and document querying over the same data set.  However we have yet to see a relational database include a document model so that a user can use document objects alongside their existing relational data.

We are only beginning to bring forth the unifying power of MySQL 8.   In the coming releases you’ll see exciting developments like being able to link your existing relational data with your document data in a single query using simple API patterns.


We have some very clear goals we follow as we develop the X DevAPI.  They are:

  • Simplicity — No one likes a complicated API.  We wanted the API to be easy to understand no matter what language you are using.   It’s important to us that if you write X DevAPI code using Node.JS then a Python developer, for example, can read it and know what is going on.
  • Bridge the gap between relational and document data — MySQL runs some of the world’s largest web properties and they have petabytes of relational data.  Asking them to add tables or columns to their data stores can be very challenging.  The new document store allows connecting these different types of data in the same queries.  We want to provide a powerful API for this.
  • Expressive — We wanted our API to be very expressive and follow a fluent interface style of development.  We wanted this to enable writing and executing the same X DevAPI code in the shell as in your application.
  • Seamless support for InnoDB Cluster farms — We want the API to seamlessly and transparently allow simple development of applications that span from one machine to hundreds.

Please note that these are goals. Some of them may not be fully realized in the initial release of the X DevAPI but these goals outline what we are thinking about during this development.


No matter what connector you use the design of the X DevAPI core components remains the same.  The API involves some central objects outlined below. You’ll hear more about these objects and more in the individual product announcements and in our documentation found at

Session Represents a logical connection to a server or farm
Schema Represents a MySQL database/schema
Collection Represents a collection of JSON documents
Result There’s a series of Result objects that handle different scenarios

Our goal is that each connector will include a core API (set of objects, properties and methods) that are the same across all connectors.  Outside of the core API, each connector can and will provide additional syntax or support additional methods.

Of course we also realize that each language and framework has it’s own style and it’s important to us to be respectful of that.  An example might be a count property that might appear as .Count  in one language but should be represented as .getCount()  in another.  Again, please recognize they are the same concept just different syntax.

Looking at the New X DevAPI Syntax

You’ll learn much more about the X DevAPI and our different languages when you read our announcement blogs and our documentation but I wanted to take just a minute to give quick examples of how you can use the X DevAPI in the shell to do quick ad-hoc prototyping.  First let’s look at opening a session to server.  In this example we open a session  to localhost and get a reference to the test schema so we can work with it.

Next we’ll create a collection and add a document to it.

We can modify the document very easily.  This example finds all documents that have a length of 250 and changes that length to 125.

We can find those documents if we want to work with them

And finally we can remove the documents and drop our collection

These have just been some quick examples but we hope that it has shown some of the basic ideas we have in the X DevAPI and you are interested in learning more and trying it out.


With the release of MySQL 8.0 we are also making available 8.0 GA versions of our connectors.  Each of them, save ODBC, provide an initial implementation of X DevAPI.  These connectors should be installed from their respective package stores.  You can also find them at our website at

You can read much more about each of the products on their announcement blogs:

We know that we have not covered every language available.  If you are using MySQL 8 with a connector in a different language please let us know.  We want to work with the community to bring X DevAPI to more and more languages.

Thank you!

I want to thank you for your time to read this and learn about our new products.  I hope that you will take the time to get to know what we’ve created and let us know where we fell down.  We have much more planned and we want to hear from you!

Introducing Connector/Node.js for MySQL 8.0

As you may have heard, MySQL 8.0 is now officially GA, and it comes with a bunch of additional goodies. Among those is the brand new Connector/Node.js, which is the official MySQL driver for Node.js and, currently, the only one with support for the latest server versions and features (such as the MySQL document store).

Here’s a rundown of what’s available:

  • Out-of-the box support for MySQL 8.0
  • Document-store API as a first-class citizen
  • TLS/SSL and SHA256 authentication
  • Fluent API with support for flexible parameters
  • Semantic methods to encode common CRUD operations
  • Modern Node.js asynchronous interface based on Promises
  • Abstractions for common database development tasks
  • Transactions, savepoints and row locking

MySQL 8.0

Connector/Node.js is currently the only driver in the Node.js ecosystem that works out-of-the-box with the latest MySQL 8.0 series and implements the brand new X Protocol and X DevAPI, which unlocks exclusive server features such as the MySQL document store.

In a nutshell, the X Protocol is based on the Google Protocol Buffers serialization format, and provides a common interface for a different set of official connectors to bridge into the MySQL server via the X plugin, which contains the server-side implementation of the document store and a surrounding scaffolding ecosystem including things like common CRUD expression trees, bound parameters, or expectations and conditions for statement pipelining.

The X DevAPI is the common client-side API used by all connectors to abstract the details of the X Protocol. It specifies the common set of CRUD-style functions/methods used by all the official connectors to work with both document store collections and relational tables, a common expression language to establish query properties such as criteria, projections, aliases, and a standard set of additional database management features for handling things like transactions, indexes, etc.

The fact that most of these features share the same format and API between connectors, makes the X DevAPI a perfect fit for mordern polyglot development environments such as microservices, and the fact that they are based on a well-documented format allows advanced users to extend client-side implementations and build new middleware components or extensions tailor-made for their use case.

Although, there are (most of the times) matching client APIs to work with relational tables, this overview will focus mostly on document-store related features. Check the official Connector/Node.js documentation or the X DevAPI user guide to get the full picture.

Secure by default

With Connector/Node.js, SSL/TLS is enabled by default for server TCP connections and, additionally, the server identity can be validated against a given certificate authority (CA).

Of course you can explicitely override this behavior (at your own peril).

Local Unix sockets don’t use SSL/TLS since they don’t really benefit much from that level of security. At the same time, that removes the possibility of any additional performance overhead caused by the SSL/TLS handshake.

In the authentication realm, besides the traditional SHA1-based server authentication plugin, Connector/Node.js also supports the latest secure authentication plugins based on SHA-256. Of course you can always use your own custom server plugins, as long as the authentication data can be sent using one of the existing client-side authentication mechanisms (in the simplest form, via plain text).

Additional details about Connector/Node.js security can be found here.

Fluent API

The public API flows nicely from a single getSession()  method. Whereas, when it comes the point of creating and issuing database operations, you get a nice fluent query builder where those operations are encapsulated in specialized and specific methods, which, compared to using raw SQL statements, brings benefits such as:

  • more readable, maintainable (and even testable) code
  • better tooling integration
    • scaffolding for code refactoring
    • text-editor (or IDE) hints and auto-completion
  • smaller SQL injection surface area
  • common standard between different programming languages and environments

Most public API methods provide alternative input handling flavors:

  • multiple individual arguments
  • a single array of arguments
  • an object with named properties (where it applies)

Promise-based asynchronous tasks

Being a good Node.js citizen, Connector/Node.js encapsulates all blocking I/O operations with asynchronous methods. Each method that sends a message to the MySQL server is expected to return a JavaScript Promise , which resolves to the specific result or fails with an error. This pattern also unlocks other platform abstractions such as the async/await  syntax, making it even more flexible for the user than just using traditional error-first callbacks.

So, after building a query, it can be sent to the server via the execute()  method. In turn, the method receives an optional callback as argument, which runs for each element in the result set. When using relational tables, an additional callback function can be used to tap into the given column metadata.

Other methods, such as the ones that operate on a single instance of a connection, database object (be it a schema, table/collection, row, document, etc.) will return a Promise  by themselves (dropping the extra call to execute() ). Some examples:

  • mysqlx.getSession()
  • session.getSchemas()
  • session.createSchema()
  • schema.getCollections()
  • schema.createCollection()
  • collection.getOne()
  • collection.addOrReplaceOne()
  • collection.replaceOne()
  • collection.createIndex()

Data consistency

With MySQL 8.0, you get session-level consistency and document-level isolation via multiple database constructs, such as transactions, savepoints and row locking. This allows to encapsulate a set of operations (particularly DML) encompassing multiple documents or collections in a single atomic procedure within a given session.

Connector/Node.js provides APIs to create, commit or rollback a transaction as well as to create, release or rollback to an intermediate savepoint within that transaction.

In the presence of concurrent transactions, the isolation level of each operation within the transaction, operating on a given document, can be determined using row locks.

Raw SQL interface

If you are looking for a feature that is still not available on the X DevAPI, or simply something that does not fit the CRUD model, you can always resort to plain old SQL.

Getting Started

If you want to use Connector/Node.js in your own project or just want to play around with, download the latest version from npm:

New releases DO NOT follow semantic versioning, so, to avoid being affected by breaking changes, make sure you use --save-exact  when pulling the package, particularly if you don’t have npm-shrinkwrap.json  or package-lock.json  files locking down your project’s dependencies.

If you are an advanced user, being an open source project, the code is hosted on the official GitHub repository and contributions are welcome, either in the form of bugs ( Connector for Node.js  category) or pull requests.

Up and Running

Assuming you are running MySQL 8.0 with the default configuration and Node.js v8.0.0  or later (for async/await  support), using Connector/Node.js and the MySQL document store in your project is as simple as follows:

These are just some of the highlights. Make sure you check out the official Connector/Node.js documentation or the X DevAPI user guide for usage examples and even more details on how to get started.

Please give it a try! Your feedback is more than welcome.

Using MySQL Connector/Python 8.0 with MySQL 8.0

The MySQL Connector/Python Team is pleased to announce MySQL Connector/Python 8.0.11, the first GA 8.0 release series of the official MySQL driver for Python. This release introduces the first Python driver that adds full MySQL 8.0 support.

Document Store

MySQL 8.0 includes many improvements and new features, with Document Store being the biggest.

MySQL Document Store is schema-less with a flexible data structure storage system for documents. This removes the requirement for schema design, normalization, foreign keys, constrains, and data types.

The Document Store is accessible by the X DevAPI, an API that introduces a new modern and easy-to-learn way to work with your data that is implemented by all MySQL Connectors that support the X Protocol, such as MySQL Connector/Python.

Getting Started



The recommended way to install Connector/Python is via pip.

Packages are also available from the MySQL Connector/Python downloads site. For some packaging formats, there are different packages for different versions of Python. Choose the one appropriate for the version of Python installed on your system.

For installation documentation, please visit the Connector/Python installation guide.

Writing your first program using the MySQL Document Store

Assuming Connector/Python 8.0 is installed on your system and you’re accessing a MySQL 8.0 server, you’re ready to write your first program using the MySQL Document Store.

For a detailed explanation of this code, please visit the Getting Started section of the official MySQL Connector/Python X DevAPI Reference Documentation.

Improved Security

Server TCP connections are now secure by default, meaning the default SSL Mode is now set to REQUIRED (mysqlx.SSLMode.REQUIRED).
Support was also added for the latest secure MySQL 8 authentication plugins based on SHA-256 hashing, such as new the caching_sha2_password authentication plugin. Usage can be implicit or explicit, for example:

Fluent API

The X DevAPI operations are structured to be “fluent”. This means it’s possible to call multiple methods to modify an object prior to execution, which enables a fluent query builder and allows more readable, maintainable, and secure code.

An example is following where where() and sort() are fluent methods to modify the find operation prior to executing it.

Support for raw SQL statements

The X DevAPI allows you to execute raw SQL statements to combine the flexibility of the document store model with the power of the relational model.

Transactions, Savepoints and Row Locking

Connector/Python provides an API to create, commit, or rollback a transaction, and also to create, release, or rollback to an intermediate savepoint within that transaction.

An optional savepoint name can be defined to create a transaction savepoint, which can later be used to rollback.

If a savepoint name is not provided, then mysqlx.Session.release_savepoint() will return a generated savepoint name.

To learn more about writing applications using the MySQL X DevAPI with Connector/Python and other MySQL connectors and clients, see

For general documentation about how to get started using MySQL as a document store, see

For more information about how the X DevAPI is implemented in MySQL Connector/Python, and its usage, see

We welcome and appreciate your feedback and bug reports:


Introducing the MySQL X DevAPI PHP Extension for MySQL 8.0

MySQL 8.0 is now finally GA, bringing into play the powerful Document Store set of feature along with Connectors for many of the most popular languages! Also PHP is coming with it’s own extension designed to support all of the new exciting feature coming with this latest MySQL milestone.

The complete web documentation for the MySQL X DevAPI Extension for PHP is available here.

About Document Store.

The X DevAPI for PHP is an extension which allows the user to access MySQL with installed the X Plugin as a document store via the X DevAPI and the related underlying protocol.

A document store differs substantially from a traditional relational database organization where a schema needs to be provided in order to push data into the database, a document store permit to insert information in a non-uniform manner, thus without the requirement of defining and maintaining a specific set of schema’s –and their links– needed to properly store the object being recorded.

This database model became very popular with NoSQL and other similar products, the MySQL document store X Plugin has the purpose of allowing the MySQL users to retain their current  MySQL configurations and being able to benefit from the new schema-less data organization.

Different language connectors are provided to access MySQL as Document Store, and in this post I’m going to focus on the powerful and widely used PHP language and it’s xdevapi extension which is the key use this MySQL functionality.

What does that mean in short? It means that now you can store non homogeneous data in your database without the need to define and specify meticulously the content of the tables, just open a xdevapi session and push your data into the database!

Installing the PHP extension

The easier way to install the extension is by using pecl tool or is possible to download the tarball file directly from this link. There are some dependencies to fulfill in order to use the extension, the most relevant is certainly boost and the protobufs libraries.

PHP Extension for MySQL 8.0 and Document Store.

First of all we need to create a connection to the database, in order to do so you need to access the mysql_xdevapi namespace and call the getSession function. getSession accepts as parameter the URI string with the credentials and address of the target server, in my example the URI is going to be: “mysqlx://root:XXX@localhost:33060/?ssl-mode=disabled“, probably during your configuration of MySQL you’ve chosen a different password so please use yours instead of XXX!

The URI strings starts with the required “mysqlx” followed by your credentials and the address of the server, the port 33060 is the default one where MySQL is listening for X DevAPI connections. Also, by default the connection with the server is going to be over SSL, is possible to change this default behavior by providing the proper ssl-mode, like in the example below:

$nodeSession is the object which handle the session for the current connection. Let’s see how to create a schema, a collection for documents and how to add a simple document:

In this code example the first two lines are for the purpose of creating a schema and a collection within the schema, in all the following samples I’ll use the variable $coll as a reference to the Collection obtained by createCollection

With the add you can trigger the insertion of a new document into the collection, each add has to be followed by the execute command, in the example code I’m submitting two documents with one add operation, you can add as many documents as you want with a single operation, each document have to be separated by a comma.

The same execute command is required by most of the DevAPI functions, before the execution of the request additional operations could be performed like adding more documents, manipulating the fields &c. The documents I’m inserting in the code sample are easy to understand JSON, if you are not familiar with JSON please have a look here.

We can verify the content of the database as well:

So, from this last shell output is clear what a collection is and how a document looks like! A collection is just a table with two columns, one representing the document itself which is a JSON and the other is the unique identifier of the document –which is a varchar-! Those ID’s are generate automatically for each inserted document, you can provide your own ID’s if you want.

The $result object returned by the add operation can be used to verify what changes has been applied to the collection or to obtain a list of the ID’s generated by the server while adding the documents.

Manipulating the documents

Let’s see how easily those Collections can be manipulated, for example removing documents can be done by using the straightforward removeOne API, which is a function that expect one single argument, the ID of the document to remove:

Is possible to look for documents using the find operation, in it’s most basic implementation the find function will require an expression that can be used to match the document to extract from the collection:

As last example here’s how is possible to modify the content of a document using the powerful modify operation. The only argument to modify is an expression that can be used to identify the documents that have to be modified, it’s then followed by one or more operation that define the modification:


There’s a strong feeling of excitement around MySQL 8.0 and his features, in particular Document Store is going to be a game changes in the industry by providing a powerful and flexible tool into the most popular and recognized DB.

What is new in Connector/C++ 8.0

We are proud to announce that with version 8.0.11 the new MySQL Connector/C++ 8.0 series becomes GA! Connector/C++ 8.0 is your gateway to the new exciting features of MySQL Server 8.0 such as MySQL Document Store. It also lets you perform your usual database tasks in a simpler and more powerful way using new, modern APIs that bring to you the full advantage of modern C++ programming language.

The 8.0 series is a true milestone in the development of Connector/C++. We have not only added new APIs but also completely re-implemented the connector to create good foundation for future innovation and improvements.The new implementation of Connector/C++ is based entirely on the new X Protocol of MySQL Server 8.0 and is highly modular to allow rapid development of new features. For the first time we aligned our APIs with other MySQL connectors. Also, for the first time Connector/C++ is offering a plain C API for code written in C.

New APIs of Connector/C++ 8.0

Up to now Connector/C++ implemented a single API based on JDBC4 standard. While keeping the old API for backward compatibility, the 8.0 series introduces two new APIs that can be used for accessing MySQL database.

  • X DevAPI: a C++ implementation of the new, fluent CRUD API defined for accessing MySQL Document Store and relational data. The same API is also implemented by xshell and other connectors and provides a uniform interface to the MySQL database.
  • XAPI: a new plain C API with functionality similar to that of X DevAPI. This API allows applications written in plain C to have access to the new MySQL features such as Document Store (it might feel strange to have plain C API in a C++ connector but in fact plain C can be seen as a subset of the C++ language; also, placing both APIs in the same connector allows re-using common implementation components).

To give you a feeling of the new APIs, here is a sample code which opens a session, creates a document collection, adds a document to that collection and then lists documents in the collection.

The same thing implemented in plain C, using XAPI, looks as follows (for simplicity, error handling logic is omitted).

Note that the choice of the API is done by including appropriate public header: either <mysqlx/xdevapi.h> or <mysqlx/xapi.h>.

Apart from a CRUD style interface for accessing the MySQL Document Store, which is shared with other MySQL connectors, the new APIs give you full access to SQL and relational data, including transactions, parameter binding, row locking, convenient classes for representing query results and more. For example, the following code shows how to execute a plain SQL query against a relational table using X DevAPI. Similar code can be written using XAPI.

The new APIs can be used as a modern replacement for the previous, JDBC based API of Connector/C++ 1.1 and for the CAPI of the MySQL client library. The X DevAPI brings the advantage and power of modern C++ programming with support for language constructs such as iterators, range loops, method chaining, RAII, overloaded operators, custom type conversions etc. The plain C XAPI is also a major re-design of the traditional MySQL CAPI with automatic memory management, better separation of public interface from internal implementation and with functions for accessing the MySQL Document Store. Note however that these new APIs are implemented over X Protocol and for that reason they will not work with older versions of MySQL Server.

For more information check available documentation on MySQL Document Store and X DevAPI User Guide. See also reference documentation for the Connector/C++ implementation of X DevAPI and XAPI reference documentation.

Getting started with Connector/C++ 8.0

Installing Connector/C++ 8.0

To develop applications that use Connector/C++ 8.0 you need the following files

  • Public headers containing declarations for the APIs implemented by the connector.
  • Connector libraries that contain implementation of the APIs. There are actually two libraries shipped with Connector/C++ 8.0 – the main library with base name mysqlcppconn8, implementing the new APIs (X DevAPI and XAPI), and a legacy library with base name mysqlcppconn which is a drop-in replacement for the 1.1 connector library. Both static and shared variants of each library are shipped.

These files are distributed as TGZ or ZIP packages that you can unpack to the location of your choice. There are several options for how to use the connector during compile time and at run-time, all depending on the platform you are working on and whether you want to install connector locally or system-wide. Below is some basic information to get you started. For more details see usage instructions in the reference manual.

Building code which uses Connector/C++ 8.0

Building code that uses Connector/C++ requires correctly setting include path, so that connector’s public headers can be found by the compiler, and passing connector library to the linker invocation. Assuming that Connector/C++ was installed under $MYSQL_CPPCONN_DIR the include path should be set to $MYSQL_CPPCONN_DIR/include (for gcc use -I option, for MSVC the C/C++ > Additional Include Directories  project setting). After that X DevAPI or XAPI declarations can be loaded using #include <mysqlx/xdevapi.h> or #include <mysqlx/xapi.h> directive, respectively.

Note: The X DevAPI uses C++11 language features. For some compilers C++11 must be explicitly enabled. For example gcc needs option -std=c++11 to understand C++11. This is not required for MSVC nor for XAPI code (which is plain C)

Depending on the platform, the shared Connector/C++ library is named:

  • on Unix platforms (soname
  • libmysqlcppconn8.dylib on the OSX platform (link name libmysqlcppconn8.1.dylib)
  • mysqlcppconn8-1-vs14.dll on Windows platforms (with import library vs14/mysqlcppconn8.lib)

You need to add this library to your compiler/linker invocation when building code that uses the connector  (for gcc add -lmysqlcppconn8 to the linker options, for MSVC add vs14/mysqlcppconn8.lib to Linker > Input > Additional Dependencies  setting of your project). You also need to specify path where the connector library can be found (for gcc use -L option, for MSVC Linker > Additional Library Directories  setting). Assuming that Connector/C++ was installed under $MYSQL_CONCPP_DIR the libraries can be found under $MYSQL_CONCPP_DIR/lib on 32-bit platforms and $MYSQL_CONCPP_DIR/lib64 on 64-bit platforms.

Example gcc invocation for building application with sources in might look as follows (assuming that environment variable MYSQL_CONCPP_DIR is set to the location where Connector/C++ was installed)

Due to ABI incompatiblities between different compiler versions, the code that uses Connector/C++ libraries should be built with the same compiler version as the connector itself. The information about compiler version used to build connector libraries can be found inside BUILDINFO.txt file distributed with the connector. In principle a different version of the compiler can be used provided that it is ABI compatible, but it is difficult to determine what versions of the compiler are ABI compatible with each other.

Running code which uses Connector/C++ 8.0

Code built against Connector/C++ depends on the shared connector library which must be found at run-time by the dynamic linker. It also requires OpenSSL libraries that are used by Connector/C++.  Here are example run-time dependencies shown by ldd for an application built with Connector/C++.

To be able to run such an application the dynamic linker must be able to find the connector library in its predefined locations. The easiest way of arranging this is to copy the shared connector library to the location of the executable. This method works for any operating system. Otherwise the exact way of registering Connector/C++ libraries with the dynamic linker depends on the operating system.

Note: For platforms such as Windows, that normally do not have OpenSSL libraries available, Connector/C++ packages include these libraries. Putting these libraries next to the connector ones usually ensures that the dynamic linker can find them at run-time.

Note: On Windows the executable will depend on the MSVC 2015 runtime DLLs, that need to be installed on the target system.

Note: Connector/C++ also ships static libraries that can be used to build applications that do not require shared connector libraries to be present on the target system. However, an application linked statically with Connector/C++ will still depend on shared OpenSSL libraries and on MSVC runtime in case of Windows.

In summary

MySQL 8 brings a lot of new, exciting features which allow you to work with your data in new ways, going beyond the traditional SQL paradigm. Connector/C++ 8.0 is a part of this story and it also invites you to exploring new ways of working with MySQL from your C++ or C code. It is a result of a long effort and we are eager to hear about your impressions of the new features we brought to you. Happy coding!

Introducing Connector/NET with full support for MySQL 8.0

Members of the .NET and MySQL communities and anyone interested in the subject, we are glad to announce the release of Connector/NET 8.0.11. This is the first GA release in the 8.0 series and it comes with full support for MySQL 8.0 (also now a GA) including its main feature… the MySQL Document Store!


What is new in MySQL 8.0?

X Protocol / X Plugin

The X Protocol is a new, highly extensible protocol optimized for SQL and CRUD API operations. It is based on the popular open source protocol definition language and provides a common interface for connectors to communicate with MySQL server through the X Plugin. The X Plugin serves as the server-side implementation of the document store among other features such as pipelining, protocol buffers, etc.

MySQL Document Store and the X DevAPI

MySQL Document Store is a flexible storage system that allows developers to work with relational tables and schema-less JSON collections in parallel. When being used to create documents you do not need to know and define all possible attributes before storing and operating with them, allowing for future customization with minimal effort.

The document store can be accessed and manipulated with the X DevAPI which is implemented by MySQL connectors that support the X Protocol, including Connector/NET. The X DevAPI is a fluent CRUD API that allows to work with JSON documents and relational data alike.

Implementation of the X DevAPI has been standardized across MySQL connectors allowing to switch to the language of choice with minimal effort. Be sure to check out the following links for additional information on the MySQL Document Store and its benefits:

A new default authentication plugin

MySQL 8.0 also introduces caching_sha2_password as the default authentication plugin. caching_sha2_password implements SHA_256 hashing as opposed to SHA_1 used by the old mysql_native_password. It also results in faster reauthentication for known users. Check out its documentation for additional details.


What is new in Connector/NET 8.0.11?

Security changes

Connector/NET comes with important security changes that will prove relevant and useful for newcomers and seasoned users alike:

  • Connections are now secure by default, meaning the default SSL Mode is now set to Required (sslmode=required).
  • Support for the new caching_sha2_password authentication plugin based on SHA_256 has been included. Note that to connect to the server using the caching_sha2_password plugin, a secure connection or an unencrypted connection that supports password exchange using an RSA key pair must be used.
  • Non-SSL connections for users set with the caching_sha2_password or sha256_password authentication plugins require that the AllowPublicKeyRetrieval connection option is set to True. This option will signal the server the need to return its public key required during RSA key encryption.

Connector/NET and the X DevAPI

Connector/NET implements the X DevAPI and exposes its features for .NET Developers. Let’s begin by showcasing how to setup the development environment.

Set Up

Setting up the environment is quick and simple, first make sure that the following requirements are met:

  • Visual Studio 2013+
  • .NET Framework 4.5.2+ / .NET Core 1.1 / .NET Core 2.0
  • MySQL Server 8.0+ with the X Plugin enabled

Then install/obtain Connector/NET 8.0.11+ via one of the following options:

  • MSI Installer
  • No-Install package
  • NuGet Package Manager (only the MySql.Data 8.0.11+ package is required)
  • Source code (for advanced users)

Note: MSI Installer, No-Install package and Source code options are all available in the main downloads page and can be selected through the “Select Operating System” drop down.

When ready to start coding simply create a .NET Framework/ .NET Core project such as a Console Project and reference the relevant assemblies as follows:

  • No-Install Package: Add a reference to the MySql.Data and Google.Protobuf assemblies by browsing to the said files within the downloaded package.
  • MSI Installer: Add a reference to the MySql.Data available in the Assemblies->Extensions section of the Reference Manager. No need to add a reference to Google.Protobuf as this is done automatically.
  • NuGet Package Manager: Simply search and install the MySql.Data package.

CRUD Example

A simple CRUD example will be used to demonstrate CRUD operations being applied to JSON documents through the use of the X DevAPI and to cover the basics:

1. Import the namespaces relevant for this code example:

Typically the MySqlX.XDevAPI and MySqlX.XDevAPI.Common namespaces will be required as they provide the basic functionality. When working on documents and collections use MySqlX.XDevAPI.CRUD, use MySqlX.XDevAPI.Relational for relational data.

2. Create a session

A session in the X DevAPI is a high-level database session concept that is different from working with traditional low-level MySQL connections. Sessions encapsulate one or more actual MySQL connections.

The X Protocol defines the connection URL which is an alternative syntax to the widely known connection strings. Connection strings are also supported when using the MySQLX.GetSession methods or any other methods that accept the connection URL such as the Session’s class constructor.

MySQLX.GetSession initiates a session ready to receive commands, no need to call the Open method as done with classic MySQL connections.

A Schema is used to store collections of documents. It can be considered the counterpart to a database within the relational model.

3. Insert a document into a collection

Collections reside within a Schema and are used to store documents. Documents can be declared in multiple ways, as .NET anonymous objects, plain JSON strings or as DbDoc instances which are the representation of a document within Connector/NET‘s implementation of the X DevAPI. DbDocs have the advantage of providing easier means to set or get properties associated to them.

Calling the Add method on a collection will mark a document as ready to be added into a collection, however it will actually be added into the collection upon calling the Execute method. This allows to keep adding documents to a queue and to add them into the collection via a single and final operation. A similar approach can be used with other CRUD operations. The Add method is overloaded to also support an array of documents.

4. Find a row within a collection

The Find method is used for retrieving documents from a collection and receives the condition for matching documents. The condition can receive parameters which can later be given a value with the Bind method. The Bind method supports receiving a DbDoc instance or a pair of strings signifying the key and value of the property being matched.

The operation returns a DocResult object containing the results of the execution and allowing to iterate through them via the Next, FetchOne, FetchAll and other methods.

5. Modify an existing document

Modify will allow updating documents based on the provided condition. Note that in this case the overload of Bind is being used to provide a value to the name1 parameter. Set method will allow setting the values to modify, in this case a new field is added into matching documents, showcasing the advantages of working with documents as opposed to the relational model! Additionally, notice the method chaining which allows for intuitive and simpler syntax for performing operations.

6. Remove a specific document

The Remove method as expected, will remove matching documents from the collection.

7. Close the session

Finally, be sure to close the session. Alternatively, taking the advantages of .NET into account, you can opt for handling sessions with a using statement which will grant the benefit of not having to explicitly close the session.

Even though this example focuses on collections and documents, similar operations can be applied to relational data as well. Refer to the reference documentation for more details.

Additional features


Sometimes, you will encounter scenarios where CRUD operations are not the best option, where a specific feature isn’t supported by the X DevAPI or simply where your preference is to use raw SQL. The X DevAPI implements the Session.SQL method allowing exactly that. Method chaining is also supported for multiple Session.SQL method calls in the same statement and upon calling the Execute method the results of the operation are returned:

Transaction Save Points

When data consistency is essential, transactions and transaction save points are the key. Methods pertaining to transaction handling are implemented through the Session class.

Transactions can be initiated with the StartTransaction method and terminated with the Rollback and Commit methods. Transaction save points allow to jump to a specific point within a transaction. Methods SetSavepoint, RollbackTo and ReleaseSavepoint will aid in this regard:

Row Locking

An additional feature for ensuring data consistency and for avoiding deadlocks comes in the form of row locking. The LockShared and LockExclusive methods allow multiple transactions to modify the same set of data concurrently. More info on row locking can be found here.

Above code snippet makes use of the LockShared method to prevent rows from being modified by other transactions. In this case, session 2 isn’t allowed to modify rows locked by session 1 until they are released.

LockShared and LockExclusive are overloaded to also receive a parameter representing the lock mode to use, providing more control over waiting actions for locked rows. Refer to the LockContention enumeration in the reference documentation for the list of lock modes available.

Document Patching

The Patch method is a yet more powerful means for modifying matching documents. By providing a JSON-like object the user can describe the changes to be applied to matching documents, those changes being new fields, removing fields, setting fields by simply providing the value or by defining a calculated value such as the result of a function:


These are just a few of the features that MySQL 8.0 and Connector/NET 8.0.11 can offer through the use of the MySQL Document Store and the X DevAPI, more are yet to come. Additional examples, code snippets and features not covered in this blog post can be found in the X DevAPI User Guide as well as in the Developer Guide and Reference documentation.

Feedback is always welcome

We are very excited to find out what our users will be able to accomplish when taking advantage of these new offerings, so please try it out and rest assured that you’ll be guided along the way. If you happen to have any questions about this or any other Connector/NET related topic you can always post them in the product’s main forum. Additionally, bugs can be reported in MySQL Bugs.

We hope to hear from you soon!

Useful links

Connector/J 8.0.11, the Face for Your Brand New Document-oriented Database

This is exciting news: MySQL 8.0 is officially GA!

This time around we do not only offer you a new MySQL Server full of exciting new features, but also a brand new toolset that let you make the most out of MySQL, including the now GA Java database driver, MySQL Connector/J 8.0.11!

This story is about Connector/J but before even I get started I must say a few words about the new features that conducted the development of this new driver. If you prefer, you can jump directly to the Connector/J 8.0 topic below.

What’s new in MySQL Server 8.0?

There’s a new Client/Server communication protocol in MySQL: the X Protocol

The X Protocol introduced in MySQL 8.0 series is the backbone for the document-oriented paradigm in the MySQL ecosystem. The new X Protocol and the old MySQL Client/Server Protocol are both available in this new MySQL Server. It is up to the clients to choose which one to implement for connecting to MySQL servers, either through pure protocol implementations or via a MySQL C API library, for example. Clearly the easiest option is to use one of the MySQL connectors that already implement either one or both of the protocols that we offer for the programming language of your choice.

The X Protocol is implemented as a plugin for the MySQL Server—the X Plugin. By default the X Plugin is listening on TCP port 33060.

Among the main features in the X Protocol you’ll find data serialization via Protocol Buffers, Vectored I/O, Pipelining, SASL authentication, extensible messages via protobuf, and so on. We are also working on other interesting features so stay tuned. I invite you to go to the X Protocol documentation to learn all about it.

So, there’s also the new X Plugin

As mentioned before, the X Plugin implements the X Protocol on the MySQL Server side.

Besides implementing the X Protocol, the X Plugin is responsible for defining the message structure that provides the base for the X DevAPI – the API that exposes a MySQL server as a document-oriented database. It is also responsible for communicating with the internal components of the server: the storage engines, the query parser, the query optimizer, query executors, and so on. In the other end, it also manages all active X DevAPI sessions and handles clients’ requests.

As of MySQL 8.0 GA the X Plugin is loaded by default. Chances are that it is already available for you in your new server installation.

Knowledge of the X Plugin will provide you insights into the features of the X DevAPI as well as how MySQL handles those features. The X Plugin documentation is, again, your best companion for learning about the plugin.

MySQL as a document-oriented database: the X DevAPI

It is through the new X DevAPI that the document-oriented database features in MySQL are exposed. This is how you use MySQL as a document store, a schema-less, and therefore schema-flexible storage system for documents. When using MySQL as a document store you do not need to know and define all possible attributes of your data before storing and operating with it. This differs from working with a relational database and storing data in a table, where all columns of the table must be known and defined before adding data to the database.

Long ago MySQL added support for JSON data along with a large variety of functions and operations that allow creating, manipulating, and handling JSON structures and values. This new data type combined with the old and reliable InnoDB based tables, with the ability to create dynamically generated columns and indexes over them, constituted the right environment for spawning MySQL’s interpretation of our document store.

The X DevAPI provides you with a unifying API for creating and handling documents in JSON format in MySQL, which you can use to develop applications. It offers a modern programming interface with a simple yet powerful design that provides support for established industry-standard concepts. One of the major keynotes in the X DevAPI is harmony you get when working with different MySQL Connectors that implement it. It becomes so easy for a developer to switch between different programming languages and still get the same “look & feel” from different Connectors.

Although MySQL Connectors are the typical entry point for using the X DevAPI, you can actually start using it even without jumping into a programming language; just try it in the new command-line client: MySQL Shell.

MySQL Reference Manual contains an overview of MySQL as a Document Store which I recommend reading. The X DevAPI User Guide is the central source of information for all common aspects of this new and exiting API.

And here’s the new MySQL command-line client: MySQL Shell

MySQL Shell is an advanced command-line client and code editor for MySQL server. In addition to the usual SQL functionality provided by the mysql client, MySQL Shell provides scripting capabilities for JavaScript and Python and includes APIs for working with MySQL. When MySQL Shell is connected to the MySQL server through the X Protocol, the X DevAPI can be used to work with both relational tables and document data.

This is the perfect companion tool for your development work with any of the new Connectors supporting X DevAPI, as it allows viewing and manipulating documents and collections easily, so that you can prototype X DevAPI calls, expressions syntax, and a lot more before starting coding them into your projects.

As of MySQL Server 8.0.11, MySQL Shell is not included in the server’s default toolset, so you will have to install it separately. Get started with MySQL Shell by downloading it from MySQL Downloads and get more info from its User Guide.

TL;DR: After all, this post is about Connector/J!

Connector/J 8.0, the new GA JDBC/X DevAPI driver for MySQL databases

I am particularly proud to announce that Connector/J 8.0 is now GA. This is the officially recommended version to use in your projects from now on. And it doesn’t matter what server version you are using.

Note that Connector/J became GA with version 8.0.11, skipping version 8.0.10, which was expected to appear after the last Release Candidate. If you haven’t heard about it, just know that several MySQL products, including Connector/J, will be version aligned with MySQL Server releases from now on. This means that you can expect new releases of Connector/J every time there is a MySQL Server 8.0 release. This doesn’t mean, however, that you must also align the Connector/J library in your projects with the server version you are connecting to. As always, our recommendation is to use the latest Connector/J library, no matter what server version you use.

Connector/J 8.0 is the rightful successor of the widely used Connector/J 5.1. Now compiled in Java 8 only, it comes with huge refactoring. Connector/J 8.0 is better organized and follows better and more up-to-date coding practices, as well as many of the exciting features of Java 8. This is also the driver to use with the new X DevAPI in the Java ecosystem.

We know that, despite our best efforts, no code is ever perfect. This is why we are continuously working on it and we really appreciate your comments and suggestions for improving this product. Therefore, please continue to use the resources we provide to get in touch with us, including the MySQL bug system, the Connector/J forum, the GitHub repository or MySQL Community Slack, with which you can talk to us directly.

Connector/J 8.0 does not only implement the JDBC 4.2 API, but also the X DevAPI for new document store features, so you can use them interchangeably. As matter of fact, the two API implementations share a lot of core base code. This is so to offer you a better user experience and versatility in your projects.

The new X DevAPI implementation provides an up to date and more user-friendly programming method with its Fluent Interface API. It all starts with obtaining a Session object, which is similar to getting a JDBC Connection, and, from then on, you have a tool to work with with Schemas, Collections and even old-style Tables. Always remember to keep Connector/J Developer Guide and the Connector/J X DevAPI Reference handy for quick reference.

Getting started with Connector/J 8.0 and X DevAPI

Initial setup & getting Connector/J binaries

Your first step should be setting up a new Java project using whatever method you prefer, immediately followed by attaching the Connector/J library. You can do it either by setting up a Maven dependency in your pom.xml or by downloading the Connector/J bundle from the official MySQL Downloads page.

In order to setup a Maven dependency just add the following in the <dependencies> section of your project’s pom.xml file, then proceed with the usual Maven commands to build and run your project:

If you choose to download the Connector/J bundle from the MySQL repositories, you must extract its contents to some temporary place and copy the following files to your project’s libraries directory:

  • mysql-connector-java-8.0.11.jar
  • lib/protobuf-java-2.6.0.jar

Instead of using the provided Protocol Buffers Java API library, you could also get protobuf-java-2.6.0.jar from its official repositories. Note that there are a few other Java libraries in the libs directory and you are not required to add them to your project if you don’t use any of the features that need them.

If you are bold enough, you can even grab the Connector/J source code and compile it yourself. This is not a task for a Java novice but you will find some help in Connector/J Developer Guide – Installing from source.

I will not go into more details but you must make sure the classpath settings include the two libraries in all further Java commands or project configurations in your IDE.

Needless to say that you will also need a MySQL Server 8.0.11 (at least) in order to proceed. If you don’t have one, you can install it in few easy steps; just choose the right package for you and follow the instructions in the Reference Manual.

Hello World, using JSON documents and X DevAPI

It is time to create the a simple demo Java class. Lets call it

You should implement proper exception handling in your application. For the sake of this demo I’ll just throw Exception  in the method main .

First thing to do is to establish a connection to the MySQL server, that is, obtaining a Session in X DevAPI terminology. Lets assume the X Plugin is listening on the default port 33060. To do this in Connector/J you first need to instantiate a SessionFactory  and then use it to create the Session  object for you:

Replace the user and password according to your database setup. The same goes for the host and port parts.

Note that jonhdoe is just a standard MySQL user. Since this user will be used to create objects in the database, please make sure that it has the required permissions to do so.

The connection string in this sample is pretty straightforward. It identifies the protocol to use (mysqlx), the user, password, hostname and port. Except for the part johndoe:password@ this is quite similar to the old JDBC connection strings. In fact, Connector/J 8.0 lets you use this same syntax for JDBC connections too.

The previous code returns a Session  object you can to use manage schemas. A Schema is essentially a MySQL database. Lets create one for this demo:

By now there should be a new database named demo in your MySQL server instance.

The Schema object you have got lets you manage collections and tables in the database. Just keep in mind that collections are just tables with a specific column structure, which you shouldn’t modify in any way other than through a X DevAPI interface.

Let’s now create a collection and add a few documents to it:

So, this creates a table named greetings in the demo database. This table has two columns: doc and _id:

The X DevAPI, through the X Plugin, manages this 1:1 mapping between the collection greetings and the table with the same name. Following X DevAPI code related to this collection operates over this relational table using a panoply of JSON functions available in MySQL server, however, all this happens internally in the server and it is transparent to clients.

Lets wrap this demo up with a couple of data retrieving operations:

This time we work with the Collection instance in order to fetch its data using two simple filters, exactly as what you would do using standard SQL tables.

The returned object DocResult  can then be used to get the list of the documents filtered from the collection. Each document is exposed as a DbDoc  instance. DbDoc  is particularly important in Connector/J X DevAPI implementation, because it represents a JSON object, something that Java doesn’t support natively.

This should be the end result of this simple demo:

With exception of the _id values, which are generated each time you add a document to a collection, you should get the same results as me, if you try out the demo.

What else?

This little demo was about a few basic CRUD operations on Collections, but there’s a lot more in the X DevAPI:

  • CRUD operations on Collections and Tables;
  • Parameter binding;
  • Document patching;
  • Various types of results and metadata;
  • Raw (SQL) statements execution;
  • Transaction save-points;
  • Row locking mechanisms;
  • Simplified expression syntax, etc.

Closing comments

MySQL Connector/J 8.0.11 is the new GA version of Connector/J for MySQL databases. It implements the X DevAPI, an exciting new feature that enables the use of MySQL Server 8.0 as a document-oriented database.

The 8.0 series of the Connector/J driver, fully re-factored from the previous GA version 5.1, requires Java 8 or above to work with. If that is a limitation for you, you can still use the Connector/J 5.1 series that supports Java 5 up to Java 8. We’ll keep maintaining the 5.1 series for the time being, but be mindful that you will only be able to use JDBC with it.

Although a feature preview version of the X DevAPI is also available in the MySQL Server 5.7 series, which you could use with Connector/J 8.0.11 and later, I recommend that you use the X DevAPI with MySQL 8.0. The X Plugin implementation in the  5.7 series has some known limitations and, most likely, no new features will be back ported to MySQL 5.7.

Exiting times are coming for all of us. Enjoy the new features we offer you and let us know what you think about them.

On behalf of the MySQL Connector/J development team, I wish you a pleasant programming experience with Connector/J 8.0.

MySQL Connector/C++ 8.0.11 GA has been released

Dear MySQL users,

MySQL Connector/C++ 8.0.11 is the first GA release version of the
MySQL Connector/C++ 8.0 series.

Connector/C++ 8.0 can be used to access MySQL implementing Document
Store or in a traditional way, using SQL queries. It allows writing
both C++ applications using X DevAPI or plain C applications using

To learn more about how to write applications using X DevAPI, see
“X DevAPI User Guide”

and “X DevAPI Reference” at

For more information about using plain C XAPI see “XAPI Reference” at

For generic information on using Connector/C++ 8.0, see

For X DevAPI or XAPI applications, Connector/C++ 8.0 requires
MySQL Server 5.7.12 or higher with X Plugin enabled. For
applications that use the legacy JDBC API, Connector/C++ 8.0
can use MySQL Server 5.5 or higher, and X Plugin is not required.

To download MySQL Connector/C++ 8.0.11, see the
“Generally Available(GA) Releases” tab at

Changes in MySQL Connector/C++ 8.0.11 (2018-04-19,
General Availability)

For MySQL Connector/C++ 8.0.11 and higher, Commercial and
Community distributions require the Visual C++
Redistributable for Visual Studio 2015 to work on Windows
platforms. The Redistributable is available at the Microsoft
Download Center
install it before installing Connector/C++.

Functionality Added or Changed

* Incompatible Change: When documents without an _id
attribute are added to a collection, the server now
automatically generates IDs for them. The server
determines the ID format, which should be considered
opaque from the API perspective (they are no longer
UUID-based). As before, no _id attribute is generated if
a document already contains one. User-provided document
IDs must not conflict with IDs of other documents in the
This capability requires a MySQL 8.0 GA server. If the
server does not support document ID generation, the
document-add operation returns an error indicating that
document IDs were missing.
For X DevAPI, the generated IDs resulting from a
document-add operation can be obtained using the new
Result.getGeneratedIds() method, which returns a list.
For XAPI, the generated IDs can be obtained using the new
mysqlx_fetch_generated_id() function, which returns IDs
one by one for successive calls, until it returns NULL to
indicate no more generated IDs are available. For both X
DevAPI and XAPI, document IDs specified explicitly in
added documents are not returned.
Incompatibility: The getGeneratedIds() method replaces
getDocumentId() and getDocumentIds(), which are now
removed. The mysqlx_fetch_generated_id() function
replaces mysqlx_fetch_doc_id(), which is now removed.

* A patch operation has been implemented that enables
specifying a JSON-like object that describes the changes
to apply to documents in a collection.
For X DevAPI, the CollectionModify operation supports a
new patch() clause for patching documents. For XAPI,
there are two new functions:
mysqlx_collection_modify_patch() directly executes
patching on documents in a collection that satisfy given
criteria. mysqlx_set_modify_patch() adds a patch
operation to a modify statement created with the
mysql_collection_modify_new() function.

* For connections to the server made using the legacy JDBC
API (that is, not made using X DevAPI or XAPI),
Connector/C++ 8.0 now supports an
OPT_GET_SERVER_PUBLIC_KEY connection option that enables
requesting the RSA public key from the server. For
accounts that use the caching_sha2_password or
sha256_password authentication plugin, this key can be
used during the connection process for RSA key-pair based
password exchange with TLS disabled. This capability
requires a MySQL 8.0 GA server, and is supported only for
Connector/C++ built using OpenSSL.

Bugs Fixed

* Single-document methods such as Collection.replaceOne()
did not accept expr() as the document specification, but
instead treated it as a plain JSON string. (Bug

* Compiling X DevAPI and XAPI test programs failed with an
error. (Bug #27610760)

* Connecting with an incorrect SSL_CA value could result in
a memory leak. (Bug #27434254)

* For debug builds, specifying a document as _id raised an
assertion rather than producing an error. (Bug #27433969)

As always, a big THANK YOU for using MySQL!

MySQL Connector/Net 8.0.10-rc has been released

Dear MySQL users,

MySQL Connector/Net 8.0.10 is the first release candidate of MySQL
Connector/Net to add support for the new X DevAPI. The X DevAPI enables
application developers to write code that combines the strengths of the
relational and document models using a modern, NoSQL-like syntax that
does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see For more
information about how the X DevAPI is implemented in Connector/Net, see

Please note that the X DevAPI requires at least MySQL Server version
5.7.12 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see

To download MySQL Connector/Net 8.0.10-rc, see the “Development
Releases” tab at

Changes in MySQL Connector/Net 8.0.10 (2018-01-30, Release Candidate)

   Functionality Added or Changed

     * The .NET Core 2.0 implementation now supports the
       following connection-string options: AutoEnlist,
       InteractiveSession, Logging, Replication, and
       UseUsageAdvisor. For more information about the options,
       see Connector/Net Connection-String Options Reference
       (Bug #27297337)

     * X DevAPI: In the process of refining the definition of
       the X DevAPI to cover the most relevant usage scenarios,
       the following API components have been removed from the X
       DevAPI implementation for MySQL Connector/Net:

          + API components that support session configurations
            The MySqlX.XDevAPI.Config namespace and all members
            of the namespace.

          + API components that support views
            CreateView(), DropView(), and ModifyView() methods
            from the MySqlX.XDevAPI.Schema class.
            ViewAlgorithm, ViewSqlSecurityEnum, and
            ViewCheckOptionEnum enumerations from the
            MySqlX.DataAccess namespace.
            The Table.IsView property remains available for
            query operations.

     * Support for .NET Core 2.0 and .NET Standard 2.0 has been
       added (.NET Core 1.1 support continues). With .NET Core
       2.0, most of the common ADO.NET classes are available for
       use, such as:

          + System.Data.DataTable, System.Data.DataColumn, and

          + System.Data.DataSet

          + System.Data.Common.DataAdapter

     * Support for Entity Framework Core 2.0 has been added
       (Entity Framework 1.1 support continues). Currently, the
       MySQL Connector/Net implementation excludes the following
       2.0 features:

          + Modeling: table splitting, owned types, model-level
            query filters, database scalar function mapping,
            self-contained type configuration for code first.

          + High performance: DbContext pooling and explicitly
            compiled queries.

          + Change tracking: attach can track a graph of new and
            existing entities.

          + Query: improved LINQ translation, group-join
            improvements, string interpolation in FromSql and
            ExecuteSqlCommand, new EF.Functions.Like().

          + Database management: pluralization hook for
            DbContext scaffolding.

          + Others: only one provider per model, consolidated
            logging and diagnostics.

     * X DevAPI: MySQL Connector/Net now supports setting and
       releasing named transaction savepoints, which can be
       assigned a name explicitly or by default using the
       savepoint_(uuid) format. In addition, a transaction can
       be rolled back to a named savepoint.
       New methods were added to the MySqlX.XDevAPI.BaseSession
       class to implement corresponding SQL statements using the
       X Protocol:

          + SetSavepoint() and SetSavepoint(name) correspond to
            the SAVEPOINT statement.

          + ReleaseSavepoint() corresponds to the RELEASE
            SAVEPOINT statement.

          + RollbackTo() corresponds to the ROLLBACK TO
       All errors generated by MySQL when one of the new methods
       is called will be returned by MySQL Connector/Net.

     * X DevAPI: The MySqlX.XDevAPI.CRUD.ModifyStatement.Patch
       method was added to enable the inclusion of JSON-like
       objects within Collection.Modify() operations that
       describe the changes to apply to all documents matching
       the condition.

     * Support for the caching_sha2_password authentication
       plugin through the classic MySQL protocol was added.
       Support through the X Protocol is limited to secure
       connections only (sslmode=required). Caching SHA-2
       pluggable authentication offers faster authentication
       than basic SHA-256 authentication.
       A new and related connection option,
       AllowPublicKeyRetrieval, was also added.

     * X DevAPI: The MySqlX.XDevAPI.Collection.CreateIndex
       method implementation was modified to enable the
       inclusion of a JSON document that defines the index to be
       created. Index-definition details can include the fields
       affected, data types, and so on.

   Bugs Fixed

     * X DevAPI: When the PLAIN authentication option was used
       to make a secure connection, the database name was
       excluded from the authenticating data and the database
       value was not set. PLAIN authentication is the default
       option for connections made with TLS or Unix Sockets.
       (Bug #27098974, Bug #88427)

     * Boolean values within a JSON document were improperly
       stored as strings. (Bug #26837112)

     * Invoking the
       method with valid arguments, including
       additionalUserAttributes as an object with key/value
       pairs, returned an out-of-range exception. Thanks to
       Stein Setvik for contributing to the fix. (Bug #25046364)

     * The default character set and encoding were not set
       properly when making a connection to MySQL 5.6 and 5.7
       servers configured to use the utf8 character set. (Bug

     * SSL connections made to a single MySQL instance could not
       be disconnected and created repeatedly without restarting
       the client application to clear the half-open sockets.
       (Bug #20393654, Bug #75022)

Nuget packages are available at:

Enjoy and thanks for the support!

On Behalf of the MySQL/ORACLE RE Team
Gipson Pulla

MySQL Connector/Net 8.0.9-dmr has been released

Dear MySQL users,

MySQL Connector/Net 8.0.9 is the sixth development release that expands
cross-platform support to Linux and macOS when using Microsoft’s .NET Core
framework. Now, .NET developers can use the X DevAPI with .NET Core and
Entity Framework Core (EF Core) 1.0 to create server applications that run
on Windows, Linux and macOS. We are very excited about this change and
really look forward to your feedback on it!

MySQL Connector/Net 8.0.9 is also the eighth development release of MySQL
Connector/Net to add support for the new X DevAPI.  The X DevAPI enables
application developers to write code that combines the strengths of the
relational and document models using a modern, NoSQL-like syntax that
does not assume previous experience writing traditional SQL.

To learn more about how to write applications using the X DevAPI, see For more
information about how the X DevAPI is implemented in Connector/Net, see

Please note that the X DevAPI requires at least MySQL Server version
5.7.12 or higher with the X Plugin enabled. For general documentation
about how to get started using MySQL as a document store, see

To download MySQL Connector/Net 8.0.9-dmr, see the “Development
Releases” tab at

Changes in MySQL Connector/Net 8.0.9 (2017-09-28, Development Milestone)

* Functionality Added or Changed

* Bugs Fixed

Functionality Added or Changed

* For accuracy, the following Entity Framework 6 items were

+ NuGet package - MySql.Data.EntityFramework (was

+ Namespace - MySql.Data.EntityFramework (was

+ Assembly - MySql.Data.EntityFramework.dll (was
(Bug #26396260)

* X DevAPI: The SessionConfigManager.Update method was
removed and the SessionConfigManager.Save method now
always overwrites the data with the given key. For
"{ \"uri\": \"mysqlx://myuser@localhost/mysess\", \"appdata\": { \"biz\": \"quux\" } }"

"{ \"uri\": \"mysqlx://test@localhost/mysess\", \"appdata\": { \"tar\": \"zzzz\" } }"

The mysess.uri and mysess.appdata values set by the first
statement are replaced with the new values set by the
second statement. (Bug #25829054, Bug #25860579)

* MySQL Connector/Net now supports MySQL servers configured
to use utf8mb4 as the default character set.

* The following methods are available for use with EF Core
in asynchronous command and connection operations:

+ Microsoft.EntityFrameworkCore.DbContext.AddAsync

+ Microsoft.EntityFrameworkCore.DbContext.AddRangeAsync

+ Microsoft.EntityFrameworkCore.DbContext.FindAsync

+ Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync

+ Microsoft.EntityFrameworkCore.Infrastructure.Databas

+ Microsoft.EntityFrameworkCore.Infrastructure.Databas

+ Microsoft.EntityFrameworkCore.DbContext.ToListAsync

* X DevAPI: The following methods execute directly, whereas
each method previously required .execute() as the final
item in the method chain:

+ BaseSession.DropSchema

+ Collection.DropIndex

+ Schema.DropCollection

+ Schema.DropView
In addition, the methods now succeed even if the objects
to be dropped do not exist.

* The AutoEnlist and IncludeSecurityAsserts
connection-string options are not appropriate for use by
applications that target .NET Core and now return an
error when used.

* EF Core: Support for explicit loading was added. Explicit
loading is an object-relational mapper (O/RM) pattern
introduced in EF Core 1.1.0, which enables .NET
developers to explicitly load related data from the
database at a later time.

* The following connection-string options are not currently
supported for use by applications that target .NET Core
and now return an error when used:

+ SharedMemoryName

+ IntegratedSecurity

+ PipeName

+ Logging

+ UseUsageAdvisor

+ UsePerformanceMonitor

+ InteractiveSession

+ Replication

* X DevAPI: To provide safe transactional document and row
updates, the following new methods were added:

+ FindStatement.LockShared

+ FindStatement.LockExclusive

+ TableSelectStatement.LockShared

+ TableSelectStatement.LockExclusive
The LockShared() and LockExclusive() methods can be
called any number of times with either the
Collection.Find() or Table.Select() method chains and in
any combination. If multiple calls to the methods are
made, only the final method is invoked. For additional
information about the two types of locking, see Shared
and Exclusive Locks

* X DevAPI: When creating a new session, multiple hosts can
be tried until a successful connection is established. A
list of hosts can be given in a connection string or as
session creation options, with or without priorities.
var mySession = MySQLX.GetSession(
"mysqlx://dbuser:password@[" +
"(address=localhost:33060, priority=90)," +
"(address=, priority=100)," +
"(address=[2001:db8:85a3:8d3:1319:8a2e:370:7348]:33060, priority=30)
" +

var mySession = MySQLX.GetSession(
"user=dbuser;" +
"password=dbpassword;" +
"server=" +
"(address=, priority=90)," +
"(, priority=100)," +
"(address=localhost, priority=30);" +

* X DevAPI: The IN and NOT IN operators have been updated
to expand the range of operands that can be evaluated by
the Find(), Modify(), and Remove() methods for
collections and the Select(), Update(), and Delete()
methods for tables. This update provides support for
expressions using the following syntax:
compExpr ["NOT"] "IN" compExpr

The previous syntax used with IN and NOT IN operators is
still valid and it takes precedence over the new syntax
when both are present.

* X DevAPI: Several new direct-execution methods were added
to the Collection class that operate at a single document
level, unlike the other CRUD methods that operate on all
documents that match a filter. The new methods are:
ReplaceOne(), AddOrReplaceOne(), GetOne(), and

* Support for connections using Unix domain socket files
was extended to include MySQL servers deployed on Linux
X DevAPI connection example:

Classic MySQL connection example:

* Connections to the MySQL server now can be made using
accounts that authenticate with the sha256_password
plugin. For more information, see SHA-256 Pluggable
In addition, a new connection option was added to extend
authentication support for connections made using the X
Protocol with either basic or URI connection strings and
as an anonymous type. The auth connection option enables
the MYSQL41, PLAIN, or EXTERNAL authentication mechanism
if supported by the server. For a description of the auth
option, see Connector/Net Connection-String Options

Bugs Fixed

* Assemblies within NuGet packages were not fully signed.
(Bug #26739307)

* EF Core: Some methods in the DbContext class were not
supported for use with asynchronous operations. (Bug
#26448321, Bug #84814)

* X DevAPI: Priority assignment when connecting to the
server in client-side failover situations was not
supported in earlier versions of the connector by design.
Priority-based failover is now available. (Bug #26198794)

* EF Core: When attempting to commit a transaction in which
the FirstOrDefaultAsync method was called, the connector
returned "System.InvalidOperationException: Connection
must be valid and open to commit transaction." instead of
committing the transaction. (Bug #26026972, Bug #86199)

* X DevAPI: Passing in a value of 0 or lower to the Limit
method now produces a more relevant error message
indicating that the argument is out of range. (Bug

* X DevAPI: Passing in the NULL value as a parameter to the
DbDoc.SetValue method resulted in an exception. This fix
ensures that NULL is accepted for this method. (Bug

Nuget packages are available at:

Enjoy and thanks for the support!

On Behalf of the MySQL/ORACLE RE Team
Gipson Pulla