繁体   English   中英

在使用XAMPP运行的mac os shell脚本中发生MYSQL mysqldump错误

[英]MYSQL mysqldump error is occurring in mac os shell script running with XAMPP

我正在尝试通过我的mac mojave 10.14.3运行xampp 7.2.12-0上的命令行运行以下脚本:

    #!/bin/sh
PATH=/usr/local/bin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Application/XAMPP/xamppfiles/bin

#----------------------------------------------------
# a simple mysql database backup script.
# version 2, updated March 26, 2011.
# copyright 2011 alvin alexander, http://devdaily.com
#----------------------------------------------------
# This work is licensed under a Creative Commons
# Attribution-ShareAlike 3.0 Unported License;
# see http://creativecommons.org/licenses/by-sa/3.0/
# for more information.
#----------------------------------------------------

# (1) set up all the mysqldump variables
database="mybackup"
backupdir="."
backupuser="root"
day=`date +%u`
mkdir -p $backupdir/$day
 echo -n "Exporting $database..."
 mysqldump --opt --user=$backupuser --all-databases > ./$day/$database.sql
 echo -n "compressing..."
 gzip ./$day/$database.sql
 echo "done"

执行此脚本会产生以下命令行错误:

backup1.sh: line 22: mysqldump: No such file or directory

当我直接运行mysqldump命令时,它会正确执行。 有没有人对我做错了什么有任何想法?

许可如下:

drwxrwxrwx+ 8 777       admin       256 Mar 16 08:44 .
drwxrwxrwx  4 777       admin       128 Mar 14 22:13 ..
-rw-r--r--@ 1 myLaptop  admin      6148 Mar 15 22:17 .DS_Store
drwxr-xr-x  7 myLaptop  admin       224 Mar 16 08:54 5
drwxr-xr-x  5 myLaptop  admin       160 Mar 16 09:18 6
-rwxr-xr-x@ 1 myLaptop  admin      1348 Mar 15 18:22 backup.sh
-rwxrwxrwx@ 1 myLaptop  admin       878 Mar 16 09:18 backup1.sh

任何帮助,万分感谢!

如果我删除

PATH=/usr/local/bin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Application/XAMPP/xamppfiles/bin

然后脚本工作。

去搞清楚?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM