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

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

First of all, I want to say that this thing is a warning. You don’t have a problem. OK, you can retreat

When I wrote a script today, I found that this warning was reported and then I didn’t respond. I always thought it was an error. In fact, it was because the execution time of mysqldump command was a little long (related to the amount of data you exported);

This script is given below to synchronize data between different databases

@ECHO OFF

@REM Remote database password
set remoteDbPwd=123
@REM local database password
set localDbPwd=123

@ECHO ON
REM source
set sourceDatabase=db1

REM target
set targetDatabase=db2

set sourceIp=127.0.0.1

@ECHO OFF
echo begin dump...

mysqldump --opt %sourceDatabase% -h %sourceIp% -uroot -p%remoteDbPwd% > config.sql

echo end dump...

echo insert to:%targetDatabase...
mysql -uroot -p%localDbPwd% %targetDatabase% < config.sql
echo success...

del config.sql /s /q

pause
exit