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

简介: 修改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的注释。

下载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和它的默认数据库吧!


相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
目录
相关文章
|
关系型数据库 MySQL Java
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
【YashanDB知识库】原生mysql驱动配置连接崖山数据库
|
安全 Linux 网络安全
YashanDB数据库服务端SSL连接配置
YashanDB支持通过SSL连接确保数据传输安全,需在服务端生成根证书、服务器证书及DH文件,并将根证书提供给客户端以完成身份验证。服务端配置包括使用OpenSSL工具生成证书、设置SSL参数并重启数据库;客户端则需下载根证书并正确配置环境变量与`yasc_env.ini`文件。注意:启用SSL后,所有客户端必须持有根证书才能连接,且SSL与密码认证独立运行。
|
SQL Java 关系型数据库
Java连接MySQL数据库环境设置指南
请注意,在实际部署时应该避免将敏感信息(如用户名和密码)硬编码在源码文件里面;应该使用配置文件或者环境变量等更为安全可靠地方式管理这些信息。此外,在处理大量数据时考虑使用PreparedStatement而不是Statement可以提高性能并防止SQL注入攻击;同时也要注意正确处理异常情况,并且确保所有打开过得资源都被正确关闭释放掉以防止内存泄漏等问题发生。
619 13
|
SQL 关系型数据库 MySQL
MySQL数据库连接过多(Too many connections)错误处理策略
综上所述,“Too many connections”错误处理策略涉及从具体参数配置到代码层面再到系统与架构设计全方位考量与改进。每项措施都需根据具体环境进行定制化调整,并且在执行任何变更前建议先行测试评估可能带来影响。
2098 11
|
Oracle 安全 关系型数据库
【Oracle】使用Navicat Premium连接Oracle数据库两种方法
以上就是两种使用Navicat Premium连接Oracle数据库的方法介绍,希望对你有所帮助!
3061 28
|
SQL 数据库连接 数据库
在C++的QT框架中实现SQLite数据库的连接与操作
以上就是在C++的QT框架中实现SQLite数据库的连接与操作的基本步骤。这些步骤包括创建数据库连接、执行SQL命令、处理查询结果和关闭数据库连接。在实际使用中,你可能需要根据具体的需求来修改这些代码。
1073 14
|
SQL XML Java
配置Spring框架以连接SQL Server数据库
最后,需要集成Spring配置到应用中,这通常在 `main`方法或者Spring Boot的应用配置类中通过加载XML配置或使用注解来实现。
947 0
|
数据库
【YashanDB知识库】YDC连接数据库报错yasdb return code is zero
【YashanDB知识库】YDC连接数据库报错yasdb return code is zero

热门文章

最新文章