修改XWiKi连接的数据库遇到的问题

本文详细记录了在CentOS上安装XWiki和MySQL的过程,包括数据库配置、权限设置及解决XWiki管理模块未加载的问题。通过修改配置文件、设置数据库用户权限和调整XWiki连接参数,最终实现了XWiki与自定义MySQL数据库的正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装二代XWiKi,安装MySql,正常运行XWiKi,见文章CentOS上安装运行XWiKixwiki使用指南。安装的数据库版本是5.6。遇到的问题是XWiKi的管理模块没有加载。
1.修改XWiKi连接的数据库为自己安装的MySql数据库,修改MySql数据库的存放路径为其它磁盘。
修改XWiKi连接的数据库配置文件:vim /usr/local/XWiki/webapps/xwiki/WEB-INF/hibernate.cfg.xml。注释掉默认hsqldb数据,放开MySQL的注释。
在这里插入图片描述
下载MySQL JDBC Driver Jar放到***/xwiki_tomcat/webapps/xwiki/WEB-INF/lib目录下:

wget http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar

2.若刚装好数据库,没有任何修改,输入mysql回车就打开了数据库了(默认无密码登录)。也可以使用/usr/bin/mysql -u root mysql回车打开数据库。
执行修改数据库root密码语句:update user set password=password("12345") where user="root";flush privileges;。用ps -ef | grep -i mysql回车查找是否安装数据库。
使用show databases;查看数据信息:

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| xwiki              |
+--------------------+
4 rows in set (0.00 sec)

3.若已经修改root密码,就用命令登录:mysql -u root -p;,输入密码并回车。若你设置了root密码,你再用/usr/bin/mysql -u root mysql;回车登录,将报下面的错误:

2018-12-17 17:26:27.430:INFO:oxtjl.NotifyListener:Thread-1: Done!
[root@localhost xwiki]# /usr/bin/mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

4.切换到mysql数据库use mysql;
5.创建xwiki数据库create database xwiki default character set utf8 collate utf8_bin;
查看所有的数据库信息:。
6.对xwiki数据库设置密码update user set password=password("12345") where user="xwiki";
可以用select * from user where User = 'xwiki';查看你新建的数据库的用户信息。
7.对xwiki数据库进行授权grant all privileges on *.* to xwiki@localhost identified by '12345'flush privileges;
若像有些文章中执行的是错误的命令:grant all privileges on xwiki.* to xwiki identified by 'xwiki';。那么你连接数据库时报下面的错误:

[root@localhost bin]# mysql -u xwiki -p;
Enter password:
ERROR 1045 (28000): Access denied for user 'xwiki'@'localhost' (using password: YES)

这个错误坑我很久。
下面是一个正常的操作的例子:

root@localhost bin]# mysql -u root -p;
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.6.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> grant all privileges on *.* to xwiki@localhost identified by 'hzbit56771010';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

8.使用xwiki用户登录数据库,可以看到登录正常了。

[root@localhost bin]# mysql -u xwiki -p;
Enter password:
ERROR 1045 (28000): Access denied for user 'xwiki'@'localhost' (using password: NO)
[root@localhost bin]# mysql -u xwiki -p;
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.6.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

9.切换到XWiKi目录cd /usr/local/XWiki,启动XWiKi./start_xwiki.sh回车。
你发现启动XWiKi成功,也不报错误。打开XWiKi主页:http://192.168.1.156:8180/xwiki/bin/view/Main/。看到的是一个没有管理模块的主页。
在这里插入图片描述
10.打开侧边栏以超级管理员登录,然后点击管理员设置,看到是这个错误警告。
在这里插入图片描述
在这里插入图片描述
查找文章:

You need to edit WEB-INF/cache/infinispan/config.xml for each instance of XWiki.

For Infinispan up till version 6, change the jmxDomain value (found under the globalJmxStatistics tag) to have a unique name, or add  allowDuplicateDomains="true" attribute for globalJmxStatistics element.
For Infinispan version 7, add <jmx duplicate-domains="true"/> element in <cache-container... element.

修改后按照提示导包后,报这样的警告,还是没有管理页面,没有管理页面怎么增加用户啊,愁人啊!
在这里插入图片描述
参看XWiKi官方安装文档, MySQL Installation。
暂时没有找到很好的解决方案。只能先用着二代安装的XWiK和它的默认数据库吧!

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值