Forums

MySQL version 8 please?

I didn't appreciate PythonAnywhere was still using MySQL version 5 and used two functions - BIN_T|O_UUID and UUID_TO_BIN that are available on my development version (8.0.24) but not on version 5

I found two functions that can provide the same functionality, but I get the error message when trying to create them:

Error Code: 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)

If I try to use the suggested solution:

set global log_bin_trust_function_creators=1;

I also get:

Error Code: 1227. Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Version 8 has been available now for well over 3 years. What are the plans to upgrade to - or offer at least, in the way we can choose what version of Python we use - MySQL 8?

Or...

Can you install these functions on two databases for me please?

DELIMITER $$

CREATE FUNCTION BIN_TO_UUID(b BINARY(16), f BOOLEAN)
RETURNS CHAR(36)
DETERMINISTIC
BEGIN
   DECLARE hexStr CHAR(32);
   SET hexStr = HEX(b);
   RETURN LOWER(CONCAT(
        IF(f,SUBSTR(hexStr, 9, 8),SUBSTR(hexStr, 1, 8)), '-',
        IF(f,SUBSTR(hexStr, 5, 4),SUBSTR(hexStr, 9, 4)), '-',
        IF(f,SUBSTR(hexStr, 1, 4),SUBSTR(hexStr, 13, 4)), '-',
        SUBSTR(hexStr, 17, 4), '-',
        SUBSTR(hexStr, 21)
    ));
END$$


CREATE FUNCTION UUID_TO_BIN(uuid CHAR(36), f BOOLEAN)
RETURNS BINARY(16)
DETERMINISTIC
BEGIN
  RETURN UNHEX(CONCAT(
  IF(f,SUBSTRING(uuid, 15, 4),SUBSTRING(uuid, 1, 8)),
  SUBSTRING(uuid, 10, 4),
  IF(f,SUBSTRING(uuid, 1, 8),SUBSTRING(uuid, 15, 4)),
  SUBSTRING(uuid, 20, 4),
  SUBSTRING(uuid, 25))
  );
END$$

DELIMITER ;

Ref: https://stackoverflow.com/questions/28251144/inserting-and-selecting-uuids-as-binary16

We have plans to provide MySQL 8 in the future, but we do not have an estimate of when that will be.

You cannot create MySQL functions on PythonAnywhere and that is unlikely to change when we do have MySQL 8 available.

Bump this topic. I am unable to use CTE's in my queries as this is a feature of MYSQL 8.

Thanks. Noted

We are now able to migrate users to MySQL 8 on request. The migration takes a few minutes plus the time it takes for us to dump and reload your databases on the new server. So larger databases will take longer. Your database will not be available during the migration. You will need to be on either the glastonbury or the haggis system image (https://help.pythonanywhere.com/pages/ChangingSystemImage/), so please make sure that you are on one of those before making the request. Send a request to support@pythonanywhere.com with an indication of a time when it will be convenient for you (between 11am and 6pm UTC on a weekday).