MySQL Compatibility

Resources

Transcript

What does it mean to be compatible with MySQL? First, I think it is important to clarify that MySQL is a moving target, as newer versions are released, new features will be added, and existing features may change slightly. In some specific cases, features may also be removed. For example, in MySQL 8.0, weaker crypto functions like ENCODE/DECODE were removed and this has been previously deprecated.

In TiDB's case, MySQL compatibility means MySQL 5.7, and this is true for both the network protocol and raw SQL syntax. That means that you can connect to TiDB using a MySQL driver (like JDBC, PHP, Python) and your application sees only MySQL. Most of the queries that your application(s) run will also continue to work without requiring any code changes.

But there are exceptions, starting with MySQL 5.7 functionality not supported by TiDB. Let's take a look at the list:

  • Stored procedures and functions
  • Views
  • Triggers
  • Events
  • User-defined functions
  • FOREIGN KEY constraints
  • FULLTEXT indexes
  • SPATIAL indexes
  • Character sets other than utf8
  • Add primary key
  • Drop primary key
  • SYS schema
  • Optimizer trace

If the lack of one of these features impacts your usage of TiDB, I recommend reading the roadmap to find features which are planned to be added.

In the next video, let's go through a case rather than a feature being missing from TiDB, which behaves differently.