Mac中MySQL数据的导入导出问题(secure-file-priv)


今天在操作数据库的时候遇到了数据库导入导出的问题,具体报错内容如下:

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

我的解决办法:

(1)首先查看 secure-file-priv 的设置情况

在终端进入 MySQL后输入命令show variables like 'secure_file_priv';

secure-file-priv 有三种情况:NULL / ‘path’(设置好的路径) /空。

NULL 表示数据的导入和导出被限制
‘path’ 表示数据的导入和导出都要在这个路径下进行
空 表示数据的导入和导出不受限制

MySQL 中默认情况下 secure-file-priv 的设置为 NULL,如下:

+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv  |  NULL |
+------------------+-------+

(2)修改 secure-file-priv 的值

正常情况下应该在 my.cnf 文件中进行配置,但是在电脑里找了好多地方都没有my.cnf文件,因此结合网上的一些说法,我在 /etc/ 下面自己新建了 my.cnf 文件,文件中所写内容如下:

# Example MySQL config file for medium systems.  
  #  
  # This is for a system with little memory (32M - 64M) where MySQL plays  
  # an important part, or systems up to 128M where MySQL is used together with  
  # other programs (such as a web server)  
  #  
  # MySQL programs look for option files in a set of  
  # locations which depend on the deployment platform.  
  # You can copy this option file to one of those  
  # locations. For information about these locations, see:  
  # http://dev.mysql.com/doc/mysql/en/option-files.html  
  #  
  # In this file, you can use all long options that a program supports.  
  # If you want to know which options a program supports, run the program  
  # with the "--help" option.  
  # The following options will be passed to all MySQL clients  
  [client]
  default-character-set=utf8
  password   = "机器的mysql密码"
  port        = 3306  
  socket      = /tmp/mysql.sock   
  # Here follows entries for some specific programs  
  # The MySQL server  
  [mysqld]
  character-set-server=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值