All we need is an easy explanation of the problem, so here it is.
Linux, 2 mariadbs each with their own .sock.
Dump as root works fine:
[[email protected]]$ mysqldump --socket=/tmp/mysqlsecond.sock --all-databases > $sqlfile
Dump as the non-root backup user requires user and password args so I added those:
[[email protected]]$ mysqldump --socket=/tmp/mysqlsecond.sock --user $user --password $password --all-databases> $sqlfile
But the result is:
Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --all-databases OR mysqldump [OPTIONS] --system=[SYSTEMOPTIONS]] For more options, use mysqldump --help
I made the backup user on the master DB as well (to try without –socket):
mysqldump --user $user --password $password --all-databases > $sqlfile
But same usage print-out. I tried various arg order, what’s the conflict?
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
--user=$user --password=$password as shown in the help for mysqldump. You may also include the user name and password in the INI file in the
[mysqldump] section to avoid using it on the command line.
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂