mysql - 在 Rackspace 中移动大型数据库的脚本 - Perl

标签 mysql perl syntax cron rackspace-cloud

我没有 Perl 经验。我们正在尝试使用 Perl 脚本将 250MB 数据库移动到 MySQL,该脚本被安排为 Cron 作业 Rackspace 云推荐了这个脚本:

#!/bin/sh
mysql -h DB_HOST -u DB_USER -p'DB_PASSWORD' DB_NAME < /path/to/file/db_import.sql

我已经填写了变量(本文的用户和通行证已更改):

!/bin/sh mysql -h mysql51-032.wc1:3306 -u 806637_Admin -p '*******' 806637_Vs_Hl < /mnt/stor09-wc1-ord1/762283/806637/www.vs-hl.com/Vs-hlDB/Vs-DB.sql

做了一些研究,我发现“#”在 Perl 中开始注释,因此我将其删除,这就是我收到的错误报告:

Bareword found where operator expected at main.pl line 1, near "/bin/sh" (Missing operator before h?)

Bareword found where operator expected at main.pl line 1, near "806637_VMHAdmin" (Missing operator before VMHAdmin?)

Number found where operator expected at main.pl line 1, near "'Admin1234' 806637_" (Missing operator before 806637_?)

Bareword found where operator expected at main.pl line 1, near "806637_Vets_Hall" (Missing operator before Vets_Hall?)

syntax error at main.pl line 1, near "/bin/sh mysql "

Execution of main.pl aborted due to compilation errors.

我的问题是我在语法方面做错了什么? 感谢您的阅读!

最佳答案

这不是 Perl 脚本,而是 Bourne Shell 脚本。只需将其移动到两个单独的行即可。

#!/bin/sh
mysql ...

请注意,#! 必须是文件的前两个字符。不能有空行继续。

关于mysql - 在 Rackspace 中移动大型数据库的脚本 - Perl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24312846/

相关文章:

php - 当我尝试将 magento 网站从服务器迁移到本地主机时出现错误

mysql - 将两个大型非规范化表拆分为多个带有链接表的表

MySql 内连接顺序

mysql - 使用代理的 Kubernetes Cloud SQL 连接

php - 您的 SQL 语法 PHP MySQL 有错误

python - 语法怪癖或为什么有效的 python

perl - 我可以在不实现子构造函数的情况下创建 Perl 子类吗?

arrays - 在 Perl 中动态创建数组

perl - 如何删除具有特定字符的整个数组

c - 为什么 c 允许 main(),即使它不是 int main() 或 void main()?