本人 想用程序在 /home下建一文件夹BackFile
(BackFile 是在程序里 system()函数创建的 chmod 777 /home/BackFile )
然后在程序里 链接mysql4.1数据库 用户名和密码 是test/test接着想把 test_db里的TbTest表的内容都导出到 20080425 文件里select * from TbTest into outfile '/home/BackFile/20080425'提示 Can't create/write into file '/home/BackFile/20080425' (Errcode:13)我用了 以下方法不行
方法一: vi my.cnf 在[mysqld]添加一行tmpdir=/home/BackFile
方法二:把BackFile 权限、组改成test的 只有select * from TbTest into outfile '20080425' 倒是可以的,但这样子 是不是不太好? 是否会造成不良后果
(BackFile 是在程序里 system()函数创建的 chmod 777 /home/BackFile )
然后在程序里 链接mysql4.1数据库 用户名和密码 是test/test接着想把 test_db里的TbTest表的内容都导出到 20080425 文件里select * from TbTest into outfile '/home/BackFile/20080425'提示 Can't create/write into file '/home/BackFile/20080425' (Errcode:13)我用了 以下方法不行
方法一: vi my.cnf 在[mysqld]添加一行tmpdir=/home/BackFile
方法二:把BackFile 权限、组改成test的 只有select * from TbTest into outfile '20080425' 倒是可以的,但这样子 是不是不太好? 是否会造成不良后果
根据上面的提示,应该是mysql没有权限创建或写入文件20080425,试试能不能写到/tmp目录,
select * from TbTest into outfile '/tmp/20080425',可以的话,再把/home/BackFile的权限改变一下,
执行以下命令:chmod -R 777 /home/BackFile或者chmod -R mysql.mysql /home/BackFile
[align=center]==== 思想重于技巧 ====
[/align]
你试了没有?ERRORCODE 13就是没有权限。难道CHOWN -R 搞不定嘛???实在不行的话
select * from TbTest into outfile '/tmp/20080425'
然后再用命令
mv /tmp/20080425 /home/BackFile/20080425