我有一个运行一系列sql语句的bash脚本:
#!/bin/bash
mysql -u root -p << QUERY_INPUT
CREATE DATABASE dba_first;
CREATE DATABASE dba_second;
CREATE DATABASE dba_third;
GRANT ALL PRIVILEGES ON `dba%`.* TO `dbuser`@`localhost`;
QUERY_INPUT
当我运行脚本时,我得到:./quick.sh: line 20: dba%: command not found
有什么建议吗?
答案 0 :(得分:2)
一位好心的人在IRC上回答;必须逃避`
GRANT ALL PRIVILEGES ON \`dba%\`.* TO \`dbuser\`@\`localhost\`;