无需修改配置文件,只需在您的 openfire 数据库中运行脚本(在 3.10.3 中验证):
## add jdbc drive
INSERT INTO `ofproperty` VALUES ('jdbcProvider.driver', 'com.mysql.jdbc.Driver');
## external membership database connection
INSERT INTO `ofproperty` VALUES ('jdbcProvider.connectionString', 'jdbc:mysql://youripaddress:3306/db_mainsite?user=root&password=root');
## auth
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.auth.JDBCAuthProvider' WHERE NAME='provider.auth.className';
## search password
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordSQL', 'SELECT plainPassword FROM dzmembership WHERE id= ?');
## encrypted type:plain,md5,sha1,sha256,sha512
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordType', 'plain');
## displyed in admin console
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.user.JDBCUserProvider' WHERE NAME='provider.user.className';
## uyser info in admin console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.loadUserSQL', 'SELECT username AS NAME,concat(username,''_'',nickname) FROM dzmembership WHERE id=?');
## user amount
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.userCountSQL', 'SELECT COUNT(*) FROM dzmembership');
## all users
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.allUsersSQL', 'SELECT id FROM dzmembership');
## search
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.searchSQL', 'SELECT id FROM dzmembership WHERE');
## username displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.usernameField', 'username');
## id displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.nameField', 'id');
## email displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.emailField', 'email');
##admin username
INSERT INTO `ofproperty` VALUES ('admin.authorizedJIDs', '13cb2932-e855-4c3e-8e54-a58e0135802d@ipaddress');
UPDATE ofproperty SET propValue='ipaddress' WHERE NAME='xmpp.domain'