secure_file_priv still NULL after editing my.cnf macOS
1
vote
1
answer
93
views
I'm trying to read a csv file into my SQL database, but I'm unable to do this because of security issues with the secure_file_priv. I went through a lot of posts that have told me to edit my.cnf to allow a folder to be accessed by SQL. Currently, my my.cnf looks like this:
I was also wondering if this had anything to do with no specifying a configuration file, but when I specified a path to my my.cnf file, my server would automatically stop after I started it.
EDIT: Adding content of the error log here
[mysqld]
secure_file_priv = /private/var/lib/mysql-files
pid-file = /usr/local/mysql/data/mysqld.local.pid
But, when I run
VARIABLES LIKE 'secure_file_priv';
I still get a value of NULL. I have also reinstalled mysql as well as restarted my database many times. While my changes in the my.cnf file are saved, there is no effect on the output.

sudo tail -f /usr/local/mysql/data/mysqld.local.err
:
2024-09-21T20:38:24.709702Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2024-09-21T20:38:29.338249Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-09-21T20:38:29.487803Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.4.2) starting as process 3726
2024-09-21T20:38:29.490033Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2024-09-21T20:38:29.495667Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-21T20:38:29.575501Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-21T20:38:29.700945Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-09-21T20:38:29.700966Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-09-21T20:38:29.712909Z 0 [System] [MY-010931] [Server] /usr/local/mysql/bin/mysqld: ready for connections. Version: '8.4.2' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server - GPL.
2024-09-21T20:38:29.712908Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
^C
% sudo tail -f /usr/local/mysql/data/mysqld.local.err
2024-09-21T20:38:24.709702Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2024-09-21T20:38:29.338249Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-09-21T20:38:29.487803Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.4.2) starting as process 3726
2024-09-21T20:38:29.490033Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2024-09-21T20:38:29.495667Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-21T20:38:29.575501Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-21T20:38:29.700945Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-09-21T20:38:29.700966Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-09-21T20:38:29.712909Z 0 [System] [MY-010931] [Server] /usr/local/mysql/bin/mysqld: ready for connections. Version: '8.4.2' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server - GPL.
2024-09-21T20:38:29.712908Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
From what I can tell, I'm not seeing any errors getting logged. But, when I run the following SQL script, I get an error.
LOAD DATA INFILE '/private/var/lib/mysql-files/table.csv'
INTO TABLE Patients
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
ERROR:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Asked by msun5040
(13 rep)
Sep 21, 2024, 05:50 PM
Last activity: Sep 21, 2024, 09:23 PM
Last activity: Sep 21, 2024, 09:23 PM