📜 ⬆️ ⬇️

mysqldump in csv format

This means that there is a task to extract data from the mysql table into a simple csv file in order to open it quickly in excel. Why do white people need such magic - I will never understand, but once the customer asked, I did. So, we give ourselves to the power of the console and write:
mysqldump -u [USER_NAME] -p "--where=[WHERE]" "--fields-terminated-by=," "--tab=./" [DB_NAME] [TABLE] > [TABLE].txt

That's all the love (the output will get two files - one with SQL and the second with CSV)

ps directory in which this command is executed must be open for writing, otherwise it will swear;)

')

Source: https://habr.com/ru/post/17631/


All Articles