CREATE DATABASE roller DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER DATABASE roller DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
(注意设置utf8的编码)
mysql -u root -p
create database roller;
grant all on roller.* to scott@'%' identified by 'tiger';
grant all on roller.* to scott@'localhost' identified by 'tiger';
use roller;
source createdb.sql
quit
JDBC连接串:
mysql://localhost:3306/roller?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
mysql://localhost:3306/roller?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
mysql4.1.*的版本建议用Connector/J 3.0.16 (or later 3.0.X series),不建议使用3.1.*的驱动
文档参考
http://rollerweblogger.org/wiki/Wiki.jsp?page=Platforms
http://rollerweblogger.org/wiki/Wiki.jsp?page=UserGuide_2.x#ref-UserGuide_2.x-41
http://rollerweblogger.org/wiki/Wiki.jsp?page=ConfigurationGuide
http://rollerweblogger.org/wiki/Wiki.jsp?page=Platforms
http://rollerweblogger.org/wiki/Wiki.jsp?page=RollerWiki
your MySQL server version for the right syntax to use near '?' at line 1" [#13]
This appears to be due to a MySQL and Connector/J bug that occurs if you use the MySQL 4.1.X server with Connector/J 3.1.X drivers. We recommend that you use the Connector/J 3.0.16 (or later 3.0.X series) drivers with MySQL 4.1.X to avoid this. You can download them from the MySQL site. Drop the jar in your CATALINA_HOME/common/lib and remove any 3.1.X drivers that you have there.
An alternate workaround that will allow you to keep the Connector/J 3.1.X drivers is to disable use of server-side prepared statements by setting the additional property useServerPrepStmts=false in both of the MySQL JDBC URLs in the context configuration.
Roller user Lee Gwun Wai has reported on the roller-user mailing list that this can also occur in the typical ISP-hosted situation where one's database is using UTF-8 but the overall server character set is something other than UTF-8. He suggests dropping the useUnicode=true from all JDBC URLs. There is additional information on hosted database configuration on our MySQL i18n Configuration Page. We have still only seen this reported with the Connector/J 3.1.X drivers.