0
点赞
收藏
分享

微信扫一扫

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


安装二代XWiKi,安装MySql,正常运行XWiKi,见文章​​CentOS上安装运行XWiKi​​​和​​xwiki使用指南​​。安装的数据库版本是5.6。遇到的问题是XWiKi的管理模块没有加载。

1.修改XWiKi连接的数据库为自己安装的MySql数据库,修改MySql数据库的存放路径为其它磁盘。

修改XWiKi连接的数据库配置文件:​​vim /usr/local/XWiki/webapps/xwiki/WEB-INF/hibernate.cfg.xml​​。注释掉默认hsqldb数据,放开MySQL的注释。

修改XWiKi连接的数据库遇到的问题_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/​​。看到的是一个没有管理模块的主页。

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


10.打开侧边栏以超级管理员登录,然后点击管理员设置,看到是这个错误警告。

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


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


查找文章:

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连接的数据库遇到的问题_创建数据库_05


参看XWiKi官方​​安装文档​​, MySQL Installation。

暂时没有找到很好的解决方案。只能先用着二代安装的XWiK和它的默认数据库吧!


举报

相关推荐

0 条评论