mysql - 在终端上自动化 MySQL 脚本

标签 mysql linux ubuntu automation

我在自动化 mysql 脚本时遇到一个问题。不知道该怎么做。

我的脚本保存为Ashish.sql。我想要自动化,以便它可以每天在设定的时间自动运行。一件事是,首先我需要在脚本运行之前截断表**(表名称是“Hash_Sun”,每当我手动运行脚本时就会推送值)**。

请帮我解决这个问题

最佳答案

您可以像这样设置 cron 规则:

@dayly mysql db_name_here < path_to_sql_file

更多信息请点击:Executing SQL Statements from a Text File

关于mysql - 在终端上自动化 MySQL 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32564927/

相关文章:

mysql - php 排序比 mysql "order by"更好吗?

php - 使用 PHP 将数组数据存储到 mySQL 数据库

mysql - 数据库设计/mysql

c - c中随机猜谜游戏中的if语句

linux - 如何在 Linux 中提取具有多种模式的行?

ubuntu - docker:如何设置 tightvncserver 密码?

mysql循环访问数据库的性能

linux - 将 awk 脚本的输出重定向到文件

linux - AppVeyor - Ubuntu 未被识别为图像

node.js - npm install 陷入困境 doParallel extraxt xxxx