注意: 按照openfire官方的只是修改openfire.xml是错误的
可以不修改openfire.xml文档
步骤:
正常步骤安装完openfire
停止openfire服务
直接在数据库运行:
UPDATE `openfire`.`ofProperty` SET propValue='org.jivesoftware.openfire.auth.JDBCAuthProvider' WHERE name='provider.auth.className';
UPDATE `openfire`.`ofProperty` SET propValue='org.jivesoftware.openfire.group.JDBCGroupProvider' WHERE name='provider.group.className';
UPDATE `openfire`.`ofProperty` SET propValue='org.jivesoftware.openfire.user.JDBCUserProvider' WHERE name='provider.user.className';
INSERT INTO `openfire`.`ofProperty` VALUES
('jdbcProvider.driver', 'com.mysql.jdbc.Driver'),
('jdbcProvider.connectionString', 'jdbc:mysql://localhost:3306/offices?user=root&password=123456'),
('admin.authorizedJIDs', 'joe@iamthat,jane@iamthat'),
('jdbcAuthProvider.passwordSQL', 'SELECT plainPassword FROM myuser WHERE username=?'),
('jdbcAuthProvider.passwordType', 'plain'),
('jdbcUserProvider.allUsersSQL', 'SELECT username FROM myuser'),
('jdbcUserProvider.loadUserSQL', 'SELECT name,email FROM myuser WHERE username=?'),
('jdbcUserProvider.userCountSQL', 'SELECT COUNT(*) FROM myuser'),
('jdbcUserProvider.searchSQL', 'SELECT username FROM myuser WHERE'),
('jdbcUserProvider.usernameField', 'username'),
('jdbcUserProvider.nameField', 'name'),
('jdbcUserProvider.emailField', 'email'),
('jdbcGroupProvider.allGroupsSQL', 'SELECT groupName FROM mygroup'),
('jdbcGroupProvider.descriptionSQL', 'SELECT description FROM mygroup WHERE groupName=?'),
('jdbcGroupProvider.groupCountSQL', 'SELECT count(*) FROM mygroup'),
('jdbcGroupProvider.loadAdminsSQL', 'SELECT username FROM mygroupuser WHERE groupName=? AND administrator=''Y'''),
('jdbcGroupProvider.loadMembersSQL', 'SELECT username FROM mygroupuser WHERE groupName=? AND administrator=''N'''),
('jdbcGroupProvider.userGroupsSQL', 'SELECT groupName FROM mygroupuser WHERE username=?');
重启openfire服务
你发现 OK了是吧