Bug #96660 | mysqldump output file issues | ||
---|---|---|---|
Submitted: | 26 Aug 2019 16:48 | Modified: | 27 Aug 2019 15:01 |
Reporter: | KIRK FRANKS | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: mysqldump Command-line Client | Severity: | S3 (Non-critical) |
Version: | Ver 8.0.17 for Linux on x86_64 | OS: | CentOS |
Assigned to: | CPU Architecture: | Any | |
Tags: | mysqldump csv-file sql-file |
[26 Aug 2019 16:48]
KIRK FRANKS
[27 Aug 2019 12:38]
MySQL Verification Team
Hi Mr. Franks, Thank you for your bug report. However, I do not think that what you have reported is a bug. First of all, you use two totally separate set of options, each coming with its own conditions and limitations. Your first run results in instructing the server to produce a file, that is created and written to by the server itself. And server is run under user `mysql`. MySQL server does not know what is Unix user that you are using. Your second command is producing SQL file by mysqldump, which is run by your user. So, this is all expected behaviour that is fully documented our Reference Manual, chapter on mysqldump. Not a bug.
[27 Aug 2019 15:01]
KIRK FRANKS
Sinisa, Your comment, 'MySQL server does not know what is Unix user that you are using', does not give me enough insight into the issue I face. This is in regard the CLI execution: /usr/bin/mysqldump -t -u root -pmypassword -T/tmp Kirk_BP_copy store_stats --fields-terminated-by=',' --where="data_date >= '2019-06-01' AND data_date <= '2019-07-31'" which produces both the sql and txt files: -rw-r----- 1 mysql mysql 3348 Aug 26 11:18 store_stats.txt -rw-rw-r-- 1 theatro theatro 0 Aug 26 11:18 store_stats.sql The mysqldump command does not invoke output redirection, which would impart ownership of the output to theatro. But you can see, one file is owned by theatro, and the other by mysql. So, if the MySQL server does not know the user, how could it give ownership to the theatro user? It appears mysqldump knew the user theatro and produced the sql file. But if it interfaces to the MySQL server for the production of the txt file, then it certainly could have conveyed the knowledge of the theatro user to MySQL and the server could have used that information to give theatro ownership of the txt file. Perhaps it's not a bug, but it seems to be worthy of a feature request. Could you show me some sample code or explain how a non-root user can change the ownership of the txt file to be theatro, without invoking sudo? I have this command embedded in a python script which is executed by theatro and cron. I have a workaround in my python script, but it involves a nasty use of sudo being passed the password. It's a hack and a security faux pas I would like to remove. Regards, -Kirk
[27 Aug 2019 15:50]
MySQL Verification Team
The answer is simple. You gave the wrong option for that command. Read our Reference Manual .....