ssh 远程执行绝对路径命令mysqld_multi 报my_print_defaults不存在
2017-12-01 23:56
609 查看
通过SSH直接执行远程命令(这种方式会使用Bash的non-interactive + non-login shell模式)找不到命令
参考:http://ghoulich.xninja.org/2017/05/09/how-to-find-env-vars-with-ssh-remote-exec-commands/
mysqld_multi会调用my_print_defaults命令,而且不会带上绝对路劲
发现ip2机器上比ip1多了个/usr/bin/my_print_defaults
原来是是通过rpm包安装的
参考:http://ghoulich.xninja.org/2017/05/09/how-to-find-env-vars-with-ssh-remote-exec-commands/
ssh root@ip1 "/usr/local/mysql/bin/mysqld_multi --defaults-extra-file=/etc/mysql/3306.cnf --no-log start 3306" WARNING: my_print_defaults command not found. Please make sure you have this command available and in your path. The command is available from the latest MySQL distribution. ABORT: Can't find command 'my_print_defaults'. This command is available from the latest MySQL distribution. Please make sure you have the command in your PATH.
问题
操作ip2却没有报此错误,而且其配置文件~/.bashr中也没有关于mysql环境变量的配置原因
non-interactive + non-login shell模式的bash执行的配置文件是~/.bashr而不是~/.bash_profilemysqld_multi会调用my_print_defaults命令,而且不会带上绝对路劲
发现ip2机器上比ip1多了个/usr/bin/my_print_defaults
[root@ip2 mysql]# rpm -qf /usr/bin/my_print_defaults mysql-5.1.73-8.el6_8.x86_64
原来是是通过rpm包安装的
解决方法
[root@ip1 ~]# ln -s /usr/local/mysql/bin/my_print_defaults /usr/bin
相关文章推荐
- mysqld_multi:WARNING: my_print_defaults command not found
- Python实现SSH远程登陆,并执行远程命令
- ssh远程执行命令并自动退出
- ssh 远程执行命令
- ssh远程执行命令方法和Shell脚本实例
- ssh 远程执行命令简介
- Python paramiko模块 实现 ssh远程执行命令 上传下载文件 堡垒机模式下的远程命令执行
- SSH无密码执行远程服务器上的命令或密码
- web测试常用python代码——ssh远程登陆以及命令执行
- linux shell执行远程计算机上的命令或者脚本(ssh)
- SSH执行远程命令和传送数据
- 很实用的sh脚本,【批量文件替换】【ssh远程命令执行】【统计某一目录下面所有文档总行数】等
- 使用ssh远程执行命令批量导出数据库到本地(转)
- SSH登录到远程linux机器并执行命令
- ssh远程执行sed -i命令,替换的内容中含有双引号的问题
- SSH在本地执行远程机器上的命令
- 使用expect工具ssh登录远程服务器并执行命令操作
- [Mysql启动报错]/etc/init.d/mysqld: line 256: my_print_defaults: command not found
- ssh、scp免秘钥远程执行命令:expect
- ssh 远程执行多个命令,有通配符要使用双引号,没有则可以不用