以下对我有用:
mysql -u 'root' -h 8.8.8.88 mo -e 'UPDATE `path_last_updated`
SET timestamp="2012-01-03 00:00:00"'
但是,以下内容不会:
TIMESTAMP=`date "+%Y-%m-%d-%T"`
mysql -u 'root' -h 8.8.8.88 mo -e 'UPDATE `path_last_updated`
SET timestamp=$TIMESTAMP'
如何将 unix 中的时间戳插入到我的 mysql 表中?
更新:
TIMESTAMP=`date "+%Y-%m-%d %T"`
mysql -u 'root' -h 8.8.8.88 mo -e "UPDATE `path_last_updated`
SET timestamp='$TIMESTAMP'"
ERROR 1064 (42000) at line 1: 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 'SET
timestamp='2013-01-31 15:46:00'' at line 1