的Ubuntu的bash的MySQL腳本訪問MySQL的看起來像從Ubuntu的猛砸
mysql -h localhost -u $MYSQLLOGIN -p$MYSQLROOTPASS -t -e '
CREATE USER [email protected]'localhost' IDENTIFIED BY $MYSQLPASS;
create database $MYSQLDB;
grant usage on *.* to [email protected] identified by $MYSQLPASS;
grant all privileges on $MYSQLDB.* to [email protected]';
收到錯誤消息
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是字符串內容變量。當我測試時,它不是空的。我究竟做錯了什麼?
收到錯誤:http://screencast.com/t/O2BFjldjYu – heron
我的壞,你需要在單引號括密碼。 –
...和用戶名也是'localhost'的所有實例... – thebjorn