最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】重新生成Openfire的全小写的MySQL数据库表项

Openfire crifan 3117浏览 0评论

【背景】

在:

【记录】在CentOS 6.6中安装OpenFire

之后,

由于Windows中对于MySQL数据库的字段区分大小写。

而之前别人代码中已经都使用了小写的数据库表项,导致OpenFire默认的驼峰发命名的数据库字段,都无法使用了。

从而直接都删除掉了。

现在需要:

确保Openfire可以重新安装。

然后重新使用小写的字母的MySQL数据库表项。

【折腾过程】

1.搜:

reinstall openfire

参考:

xmpp – How to reset openfire data? – Server Fault

去打开对应的

sudo vi /opt/openfire/conf/openfire.xml

把:

<setup>true</setup>

改为:

<setup>false</setup>

然后重启Openfire:

root@bogon:~# service openfire restart 
Shutting down openfire:                                    [  OK  ]
Starting openfire: 

2.先去确认一下数据库:

root@bogon:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21377
Server version: 5.5.44-cll-lve MySQL Community Server (GPL) by Atomicorp

Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| xxxxxxxxx          |
| test               |
+--------------------+
5 rows in set (0.00 sec)

mysql> exit
Bye
root@bogon:~# 

果然没了之前的

openfire_xxx

3.然后再去创建:

root@bogon:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21391
Server version: 5.5.44-cll-lve MySQL Community Server (GPL) by Atomicorp

Copyright (c) 2000, 2015, 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> create database openfire_xxx;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| openfire_xxx |
| performance_schema |
| xxxxxxxxx          |
| test               |
+--------------------+
6 rows in set (0.00 sec)

mysql> exit
Bye
root@bogon:~# 

注意到,此时数据库openfire_xxx中没有表的:

root@bogon:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21427
Server version: 5.5.44-cll-lve MySQL Community Server (GPL) by Atomicorp

Copyright (c) 2000, 2015, 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 openfire_xxx;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql> exit
Bye
root@bogon:~# 

4.登陆Openfire主页:

http://1.2.3.4:9090

果然进去安装界面了:

reinto the welcome page of openfire install

然后如正常的操作步骤,去继续安装,直到安装完成。

再去登陆控制台:

登陆:

用户名:root

密码:root

use admin admin to login openfire

不过登陆失败,对于用admin无法登陆的问题,详见:

【已解决】Openfire重新安装后无法用管理员账户admin登陆

5.注意:

此处,实际上,内部已经有各个表项了,且达到了所要的效果,都已经是小写的了:

root@bogon:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21555
Server version: 5.5.44-cll-lve MySQL Community Server (GPL) by Atomicorp

Copyright (c) 2000, 2015, 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 openfire_xxx;
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 tables;
+------------------------------+
| Tables_in_openfire_xxx |
+------------------------------+
| ofextcomponentconf           |
| ofgroup                      |
| ofgroupprop                  |
| ofgroupuser                  |
| ofid                         |
| ofmucaffiliation             |
| ofmucconversationlog         |
| ofmucmember                  |
| ofmucroom                    |
| ofmucroomprop                |
| ofmucservice                 |
| ofmucserviceprop             |
| ofoffline                    |
| ofpresence                   |
| ofprivacylist                |
| ofprivate                    |
| ofproperty                   |
| ofpubsubaffiliation          |
| ofpubsubdefaultconf          |
| ofpubsubitem                 |
| ofpubsubnode                 |
| ofpubsubnodegroups           |
| ofpubsubnodejids             |
| ofpubsubsubscription         |
| ofremoteserverconf           |
| ofroster                     |
| ofrostergroups               |
| ofsaslauthorized             |
| ofsecurityauditlog           |
| ofuser                       |
| ofuserflag                   |
| ofuserprop                   |
| ofvcard                      |
| ofversion                    |
+------------------------------+
34 rows in set (0.00 sec)

mysql> exit
Bye

【总结】

此处,就是通过将Openfire的配置文件:

/opt/openfire/conf/openfire.xml

中的setup字段,从true改为false。

然后进入主界面,就可以重新安装,然后自动就生成mysql数据库的相关表项。

并且自动已经把所有字段都变成小写了。

转载请注明:在路上 » 【记录】重新生成Openfire的全小写的MySQL数据库表项

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.179 seconds, using 22.12MB memory