1

I have created one file from the MYSQL syntax INTO OUTFILE.
then file has been created successfully on my given Target (/var/lib/mysql-files/).

When I execute SQL first time then created one file from the MYSQL syntax INTO OUTFILE. this file has been created on my given target (/var/lib/mysql-files/).

When I execute SQL for the second time, this error messages display me.

Error messages:

MySQL said: #1086 - File '/var/lib/mysql-files/testCsvFile.csv' already exists

Execute SQL is:

SELECT idClient,
   idUser
FROM clients_salespeople
INTO OUTFILE '/var/lib/mysql-files/testCsvFile.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '
'

Expected Result
I want this, whenever SQL is executed, then first remove the file (testCsvFile) using SQL, which is already created on the target (/var/lib/mysql-files/).

How can we do this? please Share your good experiences with me.

sanjay sisodiya
  • 455
  • 4
  • 14

0 Answers0