【问题标题】:grunt shell create databasegrunt shell 创建数据库
【发布时间】:2014-04-04 06:29:39
【问题描述】:

我正在尝试将 grunt 与 grunt-shell 一起使用来创建数据库。
问题是:如果我从 shell 创建它,这条线可以正常工作:

mysql -uroot -pmypass -e "create database test"

如果我使用 grunt 和 grunt-shell,它就不会像这样工作:

 shell: {
            install_db: {
                options: {
                    stdout: true,
                    stderr: true
                },
                command: [
                    'ssh user@demo.server.it mysql -uroot -pmypass -e "create database test"',
                ].join("&&")
            }
        }

“它不起作用”意味着打印出mysql 的参数列表,如下所示:

Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  -I, --help          Synonym for -?
  --auto-rehash       Enable automatic rehashing. One doesn't need to use
                      'rehash' to get table and field completion, but startup
                      and reconnecting may take a longer time. Disable with
                      --disable-auto-rehash.
                      (Defaults to on; use --skip-auto-rehash to disable.)
  -A, --no-auto-rehash 
...

我也试过了:

'ssh user@demo.server.it mysql -uroot -pmypass -e \"create database test\"',

'ssh user@demo.server.it mysql -uroot -pmypass -e create database test',

'ssh user@demo.server.it mysql -uroot -p -e create database test',

和许多其他相同的问题打印出mysql 命令的参数列表,它不会创建数据库。

为什么?

【问题讨论】:

    标签: mysql shell gruntjs


    【解决方案1】:

    找到问题,用mysqladmin可以正常工作:

    'ssh user@demo.server.it mysqladmin -uroot -pmypass create test',
    

    【讨论】:

      猜你喜欢
      • 2020-12-16
      • 2011-01-26
      • 2021-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-18
      • 2012-11-26
      • 1970-01-01
      相关资源
      最近更新 更多