流浪者& Puppet - 使用puphpet将sql导入mysql数据库时出错

时间:2017-05-15 21:36:48

标签: mysql vagrant puphpet

==> payments: Notice: /Stage[main]/Puphpet::Mysql::Install/Puphpet::Mysql::Databases[from puphpet::mysql::install]/Exec[users-import]/returns: sh: 1: cannot open db/dump.sql: No such file
==> payments: Error: mysql users < db/dump.sql && touch /opt/puphpet-state/db-import-users returned 2 instead of one of [0]
==> payments: Error: /Stage[main]/Puphpet::Mysql::Install/Puphpet::Mysql::Databases[from puphpet::mysql::install]/Exec[users-import]/returns: change from notrun to 0 failed: mysql users < db/dump.sql && touch /opt/puphpet-state/db-import-users returned 2 instead of one of [0]

vagrant up我收到上述错误。

sql导入文件位于db目录中(参见屏幕截图)。我想也许SQL文件没有及时复制到VM?值得注意的是,我在puphpet文件中创建了三个数据库,然后在创建最后一个数据库时导入sql。 sql文件创建表并插入一些数据。

MySQL数据库的Puphpet配置

databases:
    mysqlnd_b349iw3pewx1:
        name: sites
        sql: ''
    mysqlnd_b349iw3pewx2:
        name: ia
        sql: ''
    mysqlnd_b349iw3pewx3:
        name: users
        sql: '../db/dump.sql'

目录结构

enter image description here

我通过puphpet使用木偶。

1 个答案:

答案 0 :(得分:1)

如果您对路径不确定,正如我在评论中提到的那样只是指出文件的完整路径

databases:
    mysqlnd_b349iw3pewx1:
        name: sites
        sql: ''
    mysqlnd_b349iw3pewx2:
        name: ia
        sql: ''
    mysqlnd_b349iw3pewx3:
        name: users
        sql: '/home/vagrant/db/dump.sql'