shell - cPanel - MariaDB - 更新多个数据库中的字段
问题描述
我们有一个包含多个数据库的 cPanel 帐户。
其中一些数据库有一个公共字段,类型文本,作为片段。
这些数据库之一是 MASTER。我们想做的是在我们的 MASTER 数据库的 1 个表中更新此字段,并在其余数据库中更新相同的值。在所有数据库中,表名和字段名都是相同的。
我们已经尝试通过 shell 脚本连接到 DB 以获得新值,然后尝试更新其余数据库。当 que 保存字段的值时,它不安全正确的值。
在一个例子中:
文件查询.txt
SELECT snippet FROM wp_hfcm_scripts where snippet like '%myvalue%';
如果我们连接数据库并运行,那么好的:
mysql -D mybbdd Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 941167 Server version: 10.3.25-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mybbdd]> SELECT snippet FROM wp_hfcm_scripts where snippet like '%myvalue%'; --------------------------------------------------------------------------------------+ | <script> //myvalue 20201007 jQuery(document).ready(function($){ . . .
但是如果我们直接在命令行中启动查询,那么它会以一种奇怪的格式响应:
mysql -D mybbdd < query.sql snippet \n\t\tjQuery("#hero-responsive > p, #hero-responsive > br, #info-responsive > p, #info-responsive > br, #checkout-responsive > p, #checkout-responsive > br, #right-checkout-responsive > p, #er\n \t\t\tjQuery(element).append("<div class='video-checkout'><div
类=''><div . . .
有谁知道为什么会发生这种情况?
解决方案
推荐阅读
- firebase - Flutter MissingPluginException 上的 Firebase 初始化错误
- laravel - laravel update() 不适用于某些模型
- flutter - 导航器推送替换中的颤振上下文错误
- python-3.x - 我正在尝试使用 pythone 代码获得如下输出...有什么建议吗?
- swiftui - @EnvironmentObject 在模态表上使用时消失
- blockchain - 如何正确公开 Parastate 节点的端口?
- azure-blob-storage - 从 Azure Blob 存储到 Windows 系统上的文件
- mysql - 在存储过程中将变量作为列名传递
- r - Lubridate 中的年份功能不仅按计划执行年份
- python - 如何使用 Python 正确地将字节转换为 str 和 str 转换为字节