Issues related to performing mysqldump permissions

Source: Internet
Author: User
Permission issues to perform mysqldump
To make a backup of the entire database by clicking the button on the PHP page
$tmpname = "Wholesystem.sql";
Unlink ($setupdirection. "/tmp/$tmpname");
$command = "Mysqldump--opt--default-character-set=latin1-u $dbusername-P". $dbuserpass. "$dbnames >". $setupdirect Ion. "/tmp/$tmpname";
System ($command);
Download ($setupdirection. "/tmp/", $tmpname, $tmpname);

$command Print out the contents of the command line into the MySQL installation path under the bin, the execution succeeds!!
But with the above code, the output is always an empty SQL file
I know that the reason is that mysqldump executes directly on the command line, not internal commands, and must be executed under the bin of the MySQL installation path.

Do you want to save the MySQL installation path? The system transplant will be in trouble later.
Is there any other way to let $command run?

------Solution--------------------
Since the system porting, you should specify the full path, different systems, and even different installations will definitely put the command under different paths, including your destination directory, different systems certainly not the same.

It is recommended that you consider adding a SELECT into outfile with show create table and then using the load data infile.
------Solution--------------------
I don't know what that means upstairs.
How many times do I need to run?
In multiple databases?

mysqldump-uuser-ppass-h hostname databasename tablename1 tablename2 ...
This allows you to back up multiple tables.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.