3

I've written software that reads the MySQL bin log and uses it to sync data to another, external application. I did my development and testing on versions of MySql and MariaDB without issue. We've now deployed our application to a new client, they are using MySQL 5.5.

We created a new user using these commands:

CREATE USER 'myuser' IDENTIFIED BY 'password';
GRANT REPLICATION CLIENT ON *.* TO 'myuser';
GRANT REPLICATION SLAVE ON *.* TO 'myuser';
GRANT SELECT ON *.* TO 'myuser';
FLUSH PRIVILEGES;

This gave our new user the same permissions our application has needed everywhere else it has been run. And, sure enough, when starting the application and logging in as this user everything worked perfectly. The following day the application was still running strong but we needed to restart it because a separate heartbeat feature needed to be reset (we use this feature to determine availability). When we restarted it we started getting MySQL permissions errors:

Access denied; you need (at least one of) the SUPER privilege(s) for this operation

The error occurs when the application tries to run this command:

SHOW BINARY LOGS

If I log into MySQL Workbench as our user and try to execute SHOW BINARY LOGS, sure enough, I get the same error. But this worked for nearly 24 hours before and there haven't been any configuration changes. I have double and triple checked my user permissions in various ways including:

SHOW GRANTS FOR 'myuser'@'localhost';

Which comes back as

GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO `myuser`@`localhost` IDENTIFIED BY PASSWORD '***************'

I have tried executing FLUSH PRIVILEGES again in case somehow the in-memory GRANT table had become corrupted, but that also didn't help.

Does anyone know what could possibly be wrong here? Is there an old bug in MySQL 5.5 that causes permissions to behave finicky? Or, maybe MySQL 5.5 really does require a SUPER permission for SHOW BINARY LOGS? And if so, how can it be explained that we received thousands of database updates over the 24 hours that the application was working? These are current theories I have but I haven't been able to substantiate them with research.

4
  • 1
    Why are you using such an old version of MySQL? Version 5.5 was end of life as of 2018. Commented Nov 16, 2022 at 20:32
  • @BillKarwin Yeah, it's old but it's not really up to us. Our application connects to a MySQL database used by a 3rd party application on a machine that we don't own. So, we're just deploying our app to machines of clients of this other application. Technically they could update it, but we're positioning our software such that it will successfully run on any setup this 3rd party application can run on.
    – omatase
    Commented Nov 16, 2022 at 20:36
  • 2
    BINLOG MONITOR is a privilege specific to MariaDB. It isn't part of any version of MySQL. You should not think of MariaDB and MySQL as variations of the same product. By now they are different products. There are many cases of incompatibility. The privilege to view binary logs in MySQL is REPLICATION CLIENT. Commented Nov 16, 2022 at 20:37
  • @BillKarwin I need to update my question, I just noticed that I pasted the output from one of our MariaDB installs and not the MySQL 5.5 install. They looked almost the same so I got them mixed up. That permission is not in the GRANT statement output from the MySQL 5.5 install.
    – omatase
    Commented Nov 16, 2022 at 20:38

1 Answer 1

2

https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-6.html says:

Important Change; Replication: The SHOW BINARY LOGS statement (and its equivalent SHOW MASTER LOGS) may now be executed by a user with the REPLICATION CLIENT privilege. (Formerly, the SUPER privilege was necessary to use either form of this statement.)

So this is a new change implemented in an early milestone of MySQL 5.6, circa August 2012 (more than ten years ago!).

It took some digging, but I found the manual page for SHOW BINARY LOGS in MySQL 5.5: https://docs.oracle.com/cd/E19957-01/mysql-refman-5.5/sql-syntax.html#show-binary-logs It does not mention which privilege is required, so I'll trust that the 5.6 release notes are correct.

If you must support MySQL 5.5 (which I still think is a dubious requirement in 2022), then you must ensure that the client has SUPER privilege.

2
  • You're the man Bill. Thank you. I could not find anything in the old 5.5 logs about SHOW BINARY LOGS. I was all set to conclude that it didn't work without SUPER before but was really thrown by the fact that it worked temporarily. We'll call it temporary insanity of an old, old MySQL server version.
    – omatase
    Commented Nov 16, 2022 at 22:51
  • 1
    FWIW, I faced a similar situation once, asked to support an ancient version of the Netscape 4.x browser. I told my client it would be more economical for me to upgrade the single user who was still using that browser and also train them to use the upgraded browser, than to continue support that old app. It's not a good business decision to support software that even the vendor of that software won't support. Commented Nov 17, 2022 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.