Mysql – What settings to use to export thesql table rows that I’ll be importing to another table with data using phptheadmin

MySQLphpmyadmin

If I'm using phpmyadmin to manage mysql database, what settings should I use to export only two rows of data that I'll be importing to another table with the same name that contains many other rows?

I used the quick option, but I'm getting an error that table already exists and nothing gets imported.

If I use the default custom option with the default settings, I get the same error message.

So, what's the best settings to use to export settings that I'm going to import to another table?

Best Answer

You have two possibilities.

  1. use the export at the botton of the table, after selecting you data with the correct data

see phpmyadmin picture

  1. use SELECT INTO OUTfile

LIKE

SELECT a,b,a+b INTO OUTFILE '/tmp/result.txt'
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  FROM test_table WHERE n= 1;

Please check the limitations in the link for secure_file_priv

You can after import it via phpmyadmin or use LOAD DATA Statement