mysqldump -uroot -pmysql test> C/backup/test.sql
If I run the command above in commandline, it will do a backup for my database “test”
Now, I tried to use the same command inside my Qt C++ code, but it did not work, while I can insert,delete,and update my “test” database easily with no problems.
anyhelp please.
You need to use
::system()function to use mysqldump tool. You cannot create dump using SQL queries.You can use QProcess class for this purpose too.
Here’s an example:
Note that your mysqldump tool should be in on any dir in PATH enviroment variable.