Mysql: Exporting data without mysqldump warnings

Created on 13 Jan 2016  路  1Comment  路  Source: docker-library/mysql

Excellent image! However I am having trouble exporting data from the instance without errors. I run my export like this:

docker run -it --link containername:mysql --rm mysql sh -c 'exec mysqldump -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" dbname' | gz > output.sql.gz

However, this results in the warning:

"mysqldump: [Warning] Using a password on the command line interface can be insecure."

As the first line of the outputted file.

Is there any way to suppress this warning from the mysqldump client?

Most helpful comment

Sorry for the massive delay! If you're piping output to another program, you want to avoid using the -t flag for docker run (or docker exec). Having Docker create a TTY can interfere with the output you're trying to capture. I imagine that if you remove the -t, then the warning you're talking about will be on standard error (instead of standard out) as is appropriate, and will thus not be included in the output captured by gz. :+1:

>All comments

Sorry for the massive delay! If you're piping output to another program, you want to avoid using the -t flag for docker run (or docker exec). Having Docker create a TTY can interfere with the output you're trying to capture. I imagine that if you remove the -t, then the warning you're talking about will be on standard error (instead of standard out) as is appropriate, and will thus not be included in the output captured by gz. :+1:

Was this page helpful?
0 / 5 - 0 ratings