Reputation: 113
I've got a bash script that runs a series of sql statements:
#!/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
When I run the script, I get: ./quick.sh: line 20: dba%: command not found
Any suggestions please?
Upvotes: 2
Views: 2082
Reputation: 113
Answered by a nice person on IRC; have to escape the `
GRANT ALL PRIVILEGES ON \`dba%\`.* TO \`dbuser\`@\`localhost\`;
Upvotes: 2