【发布时间】:2013-10-21 01:41:56
【问题描述】:
Ubuntu bash mysql 脚本是这样的
mysql -h localhost -u $MYSQLLOGIN -p$MYSQLROOTPASS -t -e '
CREATE USER $USERNAME@'localhost' IDENTIFIED BY $MYSQLPASS;
create database $MYSQLDB;
grant usage on *.* to $USERNAME@localhost identified by $MYSQLPASS;
grant all privileges on $MYSQLDB.* to $USERNAME@localhost';
收到错误信息
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 '$MYSQLPASS' at line 1
事实上 $MYSQLPASS 是可变字符串内容。当我测试时,它不是空的。我做错了什么?
【问题讨论】: