Quick ones – Synonym Creation in MySQL 5.7

MySQL

In MySQL 5.7, anyone who has just installed their server and runs a SHOW PROCEDURE STATUS command will be surprised by the number of procedures and functions that have been added. One of them is create_synonym_db, which we will use to create schema (database) synonyms.

These procedures are located in MySQL’s new operational database: sys. The procedure only exists in this schema, so either you must be connected to the sys database, or create an alias for it. This is the first downside of this procedure — and a downside of the documentation as well, which does not make this clear at all.

So, let’s create our synonym info for our old friend INFORMATION_SCHEMA:

Rapidinha – Criação de Sinônimos no MySQL 5.7

By doing this, our synonym is presented as a schema:

MySQL

One annoying thing: the tables under a synonym schema are case-insensitive.

To “kill” a synonym schema, just run a DROP DATABASE (on the synonym) without fear.

Schedule a meeting here

Visit our Blog

Learn more about databases

Learn about monitoring with advanced tools

MySQL

Have questions about our services? Visit our FAQ

Want to see how we’ve helped other companies? Check out what our clients say in these testimonials!

Discover the History of HTI Tecnologia

Compartilhar: