开发者

Are any permissions required to backup a mysql table through php script

I want to take back up of mysql database table in sql file through php script.

I am using below code.

mysql_query("SELECT * INTO OUTFILE 'backupfile.sql' FROM tablename");

It gives me following error :

Access denied for user 'username'@'localhost' (using password: YES)

The 'username' has these permissions :

SELECT, INSERT, UPDATE, DELETE, INDEX, CREATE, ALTER, DROP, LOCK TABLES, REFERENCES, CREATE ROUTINE, CREATE TEMPORARY TABLES

I just want to know is there any extra permission required to execute select * into outfile and same for the LOAD DATA INFILE开发者_运维问答 'filename' INTO TABLE tablename.


You need the FILE privilege to use SELECT ... INTO OUTFILE, since the command will create a file on the MySQL server host.

I also think your query is wrong. This should be the right order according to the manual:

SELECT * FROM tablename INTO OUTFILE 'backupfile.sql';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜