I am trying to backup a table records with php. I use the following code to get data:
$table_name = "my_table";
$backup_file = dirname(__FILE__)."/backup/my_table.sql";
$sql = "SELECT * INTO OUTFILE '$backup_file' FROM $table_name";
$retval = mysql_query( $sql, $conn );
But, the last line gives the following error:
Access denied for user 'user_name'@'10.1.1.9' (using password: YES)
I changed the file permission for backup directory and its files to 777. But still the same error exists.
Now, I want to know, in the SELECT * INTO OUTFILE , is it possible to store the backup data into a variable (instead of the file). So then I can store that variable into a file?