如何在Expect/TCL脚本中从转储文件创建MySQL数据库? [英] How to create a MySQL database from dump file in expect/TCL script?

查看:90
本文介绍了如何在Expect/TCL脚本中从转储文件创建MySQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在Expect脚本中执行此bash命令:

I just wanted to execute this bash command in expect script:

mysql -u root -h localhost -proot dbTest < temp.sql

我在开头添加了spawn,但是它不起作用.我认为<"符号表示没有任何期望!

I added spawn to the beginning but it is not working. I think "<" symbol means nothing in expect!

有人可以帮助我解决此问题吗?

Can anyone help me to solve this issue?

推荐答案

我现在找到了解决此问题的方法.我避免了<"符号,因此我们可以改用以下命令:

I have now found a solution for this problem. I avoided the "<" symbol, so we can use this command instead:

spawn mysql -u root -h localhost -proot dbTest -Bse "source temp.sql"

这篇关于如何在Expect/TCL脚本中从转储文件创建MySQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆