Solution to the error "You do not have the SUPER privilege and binary logging is enabled"

Author
By Darío Rivera
Posted On in MySQL

Today we will see a very common error in MySQL when we try to create or update some objects of the database, such as triggers. The error is related to the use of binary logs, and probably it has happened to you a couple of times, the error in question is the following:

SQLSTATE[HY000]: General error: 1419 You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

Origin

This error arises because binary logs are enabled in the database and you are trying to make some changes at the level of stored procedures, functions, triggers, or events.

The binary log contains information about all the changes that have been made to the database at a certain time, in such a way that with them, it is possible to reconstruct the current state of the database. This is useful, for example, for replication instances where such information is received and executed in the expected order to reach the same state as the master instance.

Solution

If you are sure that the changes you are going to make will not affect the binary logs, you can run the following command:

set global log_bin_trust_function_creators = 1;

Once this is done, you can make your changes and the previous error will not appear. To re-enable this restriction, you can configure the same variable with the value zero.

set global log_bin_trust_function_creators = 0;

Acerca de Darío Rivera

Author

Application Architect at Elentra Corp . Quality developer and passionate learner with 10+ years of experience in web technologies. Creator of EasyHttp , an standard way to consume HTTP Clients.

LinkedIn Twitter Instagram

Sólo aquellos que han alcanzado el éxito saben que siempre estuvo a un paso del momento en que pensaron renunciar.