【问题标题】:BASH script not reading input mysql password [duplicate]BASH脚本未读取输入mysql密码[重复]
【发布时间】:2012-11-18 22:02:44
【问题描述】:

可能重复:
How to execute Mysql command from a shell script?

我正在尝试使用 bash 脚本执行 .sql 文件。但我在连接到 MySQL 时遇到问题。到目前为止,这是我所拥有的:

#! /bin/sh
PWD="thepassword"
mysql -p -u theuser < Randomsqlfile.sql
echo $PWD

提示密码时,什么都不填。

【问题讨论】:

    标签: mysql bash passwords


    【解决方案1】:

    做这个:

    mysql -utheuser -pthepassword <Randomsqlfile.sql
    

    【讨论】:

      猜你喜欢
      • 2012-05-17
      • 1970-01-01
      • 2012-05-23
      • 2018-07-07
      • 2015-08-03
      • 1970-01-01
      • 2019-11-02
      • 2018-07-05
      • 1970-01-01
      相关资源
      最近更新 更多