Warning password insecure - Mysql backup with Python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Warning password insecure - Mysql backup with Python (/thread-3627.html) |
Warning password insecure - Mysql backup with Python - HyiikO - Jun-08-2017 I made this little script with Python to create a backup of a table from my database: import subprocess sql_cmd = 'mysql -B -uUser -p password database -e "SELECT * FROM device;" > file.csv' subprocess.run([sql_cmd], shell=True)It is working, but I got this warning message: mysql: [Warning] Using a password on the command line interface can be insecure. I would like to solve this problem if someone can help me please Thanks ^^ RE: Warning password insecure - Mysql backup with Python - wavic - Jun-08-2017 OS?.. Quote:The message is too short. Please enter a message longer than 5 characters.Next time I will add periods like that RE: Warning password insecure - Mysql backup with Python - r3d_f0x - Jun-08-2017 That looks like a MySQL warning. You could try a way to securely store the password. RE: Warning password insecure - Mysql backup with Python - nilamo - Jun-09-2017 Instead of using subprocess to invoke the command line client, you could use a mysql api to query the database directly. That would eliminate the "password using command line" issue. RE: Warning password insecure - Mysql backup with Python - snippsat - Jun-09-2017 As mention bye @nilamo there are tool for this in Python to connect directly. PyMySQL pure-Python MySQL client library mysqlclient |