First of all, I ask for your patience, because has to be a very simple question, but I'm not able to find it.
I have created a simple database to store emails. For this database I have created a simple user with FILE privilege.
CREATE USER 'email'@'%' IDENTIFIED BY 'mypassword';
CREATE DATABASE email CHARACTER SET 'UTF8MB4';
GRANT ALL PRIVILEGES ON email.* TO 'email'@'%';
GRANT FILE ON *.* TO 'email'@'%';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'email'@'%';
In this database, I have an Email table, with a LONGBLOB field
CREATE TABLE `Email` (
`Id` char(36) COLLATE ascii_general_ci NOT NULL,
`RawContent` longblob NULL
CONSTRAINT `PK_Email` PRIMARY KEY (`Id`)
) CHARACTER SET=utf8mb4 ROW_FORMAT=COMPRESSED;
And now, I try to get the content (the content is correctly loaded, and I'm able to get it by code). I try the following SQL
SELECT
Email.RawContent INTO DUMPFILE '/tmp/test.eml'
FROM
Email;
But I get always the error
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
mysql> SHOW GRANTS;
+----------------------------------------------------------+
| Grants for email@localhost |
+----------------------------------------------------------+
| GRANT FILE ON *.* TO `email`@`localhost` |
| GRANT ALL PRIVILEGES ON `email`.* TO `email`@`localhost` |
+----------------------------------------------------------+
2 rows in set (0,00 sec)
I have already test restarting the mysql server with sudo systemctl restart mysql
I'm running mysql 8.0.32 on Ubuntu 22.04.
mysql --version
mysql Ver 8.0.32-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))