如何在线执行包含多个数据库语句的sql文件?

发布于 2025-01-06 15:41:57 字数 221 浏览 4 评论 0原文

最近,我的要求之一是一次性修改多个数据库,并且我一直在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生殊途 2025-01-13 15:41:57

我不知道“在线模式”,但是如果你想让你的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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文