MYSQL表数据导到文件时出现The MySQL server is running with the --secure-file-priv option

 MYSQL表数据导到文件

SELECT * FROM student INTO OUTFILE 'G:/temp/student.txt';

出现错误提示

错误代码: 1290
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

原因是权限问题

通过show variables like '%secure%';查看 secure-file-priv 当前的值是什么

发现secure_file_priv的值为NULL, 导出的数据必须是这个值的指定路径才可以导出,默认是NULL就代表禁止导出

通过mysql的配置文件my.ini可以修改其值。在my.ini文件中添加如下 

重启mysql服务,执行show variables like '%secure%';

接下来就可以导出表数据到G:\temp目录的文件中了

SELECT * FROM student INTO OUTFILE 'G:/tem/student.txt';

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
If the designated data directory "/home/test/mysql-8.0/data/" is unusable, you can remove all the files that the server added to it. However, please note that removing these files will delete all the data stored in the MySQL database. Make sure to backup any important data before proceeding with the following steps: 1. Stop the MySQL server: Use the appropriate command to stop the MySQL server. For example, you can use `sudo service mysql stop` or `sudo systemctl stop mysql` depending on your system. 2. Remove the data directory: Execute the following command to remove the data directory and its contents: ``` sudo rm -rf /home/test/mysql-8.0/data/ ``` Please be cautious when using the `rm` command with the `-rf` options, as it will recursively delete all files and directories without confirmation. 3. Recreate the data directory: After removing the data directory, you can recreate it using the following command: ``` sudo mkdir /home/test/mysql-8.0/data/ ``` 4. Set appropriate permissions: Ensure that the newly created data directory has the correct permissions for MySQL to access and modify it. You can set the necessary permissions using the following command: ``` sudo chown -R mysql:mysql /home/test/mysql-8.0/data/ sudo chmod -R 770 /home/test/mysql-8.0/data/ ``` These commands will change the ownership of the directory to the MySQL user and grant appropriate read, write, and execute permissions. 5. Start the MySQL server: Start the MySQL server using the appropriate command. For example, you can use `sudo service mysql start` or `sudo systemctl start mysql`. After completing these steps, the data directory should be recreated and ready for MySQL to use. However, keep in mind that all previous data will be lost.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值