When backing up mysql data, report/usr/bin/bash: mysqldump: commandnot found, how to solve it

  mysql, question

StringBuffer sb = new StringBuffer(“mysqldump”);

sb.append(” -u”).append(noteMap.get(“user”)).append(” -p”).append(noteMap.get(“password”)).append(” -h”).append(noteMap.get(“jdbcUrl”)).append(” shomop_group1″).append(” user”)
.append(” -t -c “).append(” –set-gtid-purged=OFF –single-transaction | gzip>/backup/userBack/”).append(shadeName).append(“_”).append(DateUtil.getDayString(date))
. append (“_”). append (dateutil.getdaystring (dateutil.adddays (date, plus 1))).append(“.sql.gz “);

Process ps = runCommond(“sh”, “-c”, sb);

Bash finds the command through the path contained in the $PATH environment variable./usr/bin/bash: mysqldump: command not foundBash did not find mysqldump in $PATH.

There are two situations:

  1. The directory where mysqldump is located does not include $PATH and can be accessed throughecho $PATHConfirm.

  2. Mysqldump is not installed

In general, the probability of the second situation is higher, so the topic owner can search how to install mysqldump in his own system and install it.