Disable secure priv for data loading on MySQL

前端 未结 5 2051
刺人心
刺人心 2020-12-13 14:46

I\'m running MySQL 5.7 on a Windows 10 machine. I\'ve read through all the SO threads on this topic and still haven\'t figured out how to get my data to load and get past th

5条回答
  •  难免孤独
    2020-12-13 15:28

    This works in MacOs Sierra 10.12.6:

    use the command

    mysql --help | more
    

    and look for a line where it is written:

    Default options are read from the following files in the given order:
    /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf 
    ~/.my.cnf
    

    In my case I tried to create a my.cnf in the home directory but it did not work. The only solution I found is to create the file in the folder etc with

    sudo vim /etc/my.cnf
    

    and put inside it

    [mysqld_safe]
    [mysqld]
    secure-file-priv = ""
    

    Then you can check that everything works with

    select @@GLOBAL.secure_file_priv;
    

    inside mysql and check that the value is empty and different from NULL.

    Finally save files in the directory /tmp and then move them in the directory you want. Alternatively (but possibly unsafe) use

    chmod 1777 dir
    

    where dir is the name of the directory in which you are writing the files.

提交回复
热议问题