0

I have a huge amount of data in MariaDB. I need to do create dump files from queries. So far I got something like this.

SELECT DISTINCT uretici INTO OUTFILE '/home/admin/web/example.com/public_html/public/manufacturers.sql' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM data;

This gives me a SQL file which is cant be imported. I need an importable SQL file. What to do about it?

Kıvanç.A
  • 19
  • 1
  • 5
  • 1
    Does this answer your question? [How to export and import a .sql file from command line with options?](https://stackoverflow.com/questions/11407349/how-to-export-and-import-a-sql-file-from-command-line-with-options) – nbk Jul 10 '21 at 23:18

1 Answers1

3

You can use the following command

mysqldump -u [database_user] -p [database_name] | gzip > [filename_to_compress.sql.gz]
Samuel Silas
  • 299
  • 1
  • 4
  • 12
  • If you need any clarifications please let me know – Samuel Silas Jul 10 '21 at 23:16
  • 1
    Thank you for your answer samuel. I solve this problem while ago with the following command. ``` mysqldump -u root -pxxx admin_tecalliance data -w "oem_no IS NOT NULL " > file.sql;" ``` – Kıvanç.A Jul 22 '21 at 14:26