您好,我正在尝试使用 MySQL 客户端在 Ubuntu 终端上运行 belo sql
mysql -u root \
-proot -e "SELECT * FROM knexus.redis_cache WHERE `key` LIKE '%hub.local%'"
我遇到以下错误
The program 'key' is currently not installed. You can install it by typing:
sudo apt-get install donkey
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%hub.local%'' at line 1
但是 SQL 在 MYSQL 终端上运行正常。
我猜这可能是字符转义问题,正如我所看到的sudo apt-get install donkey
。
最佳答案
刻度帧key
导致bash将key视为命令并用命令中的输出替换它。您可以尝试不使用它们,或者将整个命令放在单引号中,将 %hub.local% 放在双引号中。
关于mysql - 如何解决在 mysql 客户端使用 -e 时出现反引号错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38475995/