如何在线执行包含多个数据库语句的sql文件?
最近,我的要求之一是一次性修改多个数据库,并且我一直在使用 SOURCE 命令来执行文件(.sql 文件)
但是,我想知道是否有一种在线方法可以做到这一点,因为这样我即使我注销或出现任何网络问题并且我的会话结束,也可以使用 nohup 让它运行。通过在线模式,我的意思是不必进入 mysql 命令行 ( mysql> )
想知道这是否可能?请注意,SQL 文件的目标是一次性修改多个数据库。
Recently, one of my requirements have been to modify multiple dbs at one go and i have been using SOURCE command to execute the file (.sql file)
However, i wanted to know if there is an online way to do it because that way i can use nohup to let it run even if i log out or any network issues come along and my session ends. By online mode, i meant not having to go to mysql command line ( mysql> )
Wanted to know if this is possible at all? Please note that SQL file is targeted to modify multiple DBs at one go.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道“在线模式”,但是如果你想让你的mysql运行,即使你在出现网络问题时注销,我建议你使用GNU 屏幕。如果您的会话结束,在 screen 内运行的任何内容都将继续在后台运行,并且当您再次登录时,您可以使用
screen -r
重新连接您的会话。I don't know about an "online mode", but if you want to let your mysql run even if you log out if a network issue come along, I suggest you use GNU screen. If your session ends, anything runned inside screen will continue to run in the background, and you'll be able to reattach your session with
screen -r
when you'll signin again.