linux - Bash escaping (MySQL GRANT ALL PRIVILEGES is failing) -
there bash doesn't like. should escaped , how?
mysql --user=root --password=mypass vsftpd << eof grant privileges on `myusername\_%`.* 'myusername'@'%';" eof
i following error:
-bash: myusername_%: command not found error 1064 (42000) @ line 1: have error in sql syntax; check manual corresponds mysql server version right syntax use near '* 'myusername'@'%'' @ line 1
the backticks command substitution (same $()
). try using single quotes on outer level , double quotes username , hostname:
mysql --user=root --password=mypass vsftpd 'grant privileges on `myusername\_%`.* "myusername"@"%";'
you can instruct here doc not expand variables quoting delimiter word, i'm not sure if works command substitution too:
mysql --user=root --password=mypass vsftpd << 'eof' grant privileges on `myusername\_%`.* 'myusername'@'%';" eof
Comments
Post a Comment