Hello, I am currently trying to install an XWiki 10.1 (Standard Flavor) instance from the official xwiki:10-mysql-tomcat docker image using the provided docker-compose files. Adding Subwikis does not work out of the box:
The Wiki by default uses the “xwiki” MySQL user, which is (I assume) created during the installation process by using the MySQL root user (XWiki also knows the MySQL root password).
After setup, the xwiki MySQL user has the following grants:
±-------------------------------------------------+
| Grants for xwiki@% |
±-------------------------------------------------+
| GRANT USAGE ON . TO ‘xwiki’@‘%’ |
| GRANT ALL PRIVILEGES ON xwiki.* TO ‘xwiki’@‘%’ |
±-------------------------------------------------+
In a default MySQL installation, this new “xwiki” user seems to not be able to create new databases. This is however required for creating subwikis (on MySQL, Subwikis must exist in separate databases, as XWiki documentation suggests). Creating a new Wiki through the Wiki index therefore fails.
unsuccessfull solution attempts:
Granting CREATE (or even ALL) permissions to the xwiki user does not help, as the user then might be able to create a database, but won’t be allowed to access it. According to this blog post, enabling a non-root user to create and populate databases would require updating the createdb stored procedure. This feels hacky…
Creating the database for the new wiki beforehand and granting permissions to the xwiki MySQL user does not work. The Subwiki creation process complains that the database already exists.
A workaround I have found is to start xwiki with the MySQL root user.
Is there something wrong with my setup, or is there currently no clean way to create subwikis in my configuration?
Just checked and @blablub44 (or anyone else) has not created the jira issue that I mentioned above (at least I can’t find it at Loading...), and thus, this has not been tasked and no work is being done on it by anyone.
Having a jira issue is the first step. Second step is finding someone to provide a pull request for it.
As I said above:
Unfortunately @blablub44 has not answered so I don’t know the command I mentioned worked or not.
I tried starting the docker container with root mysql user as well as your suggestion. Both unfortunately did not work. Of course I can open a Jira issue, just wanted to make sure I don’t report anything that’s already being worked on.
EDIT: Starting with mysql root worked after actually changing it in the config…
Hi, I just wanted to ask if you could get rid of this problem.
I ran into the same problem and now I have to put the user “root” into the hibernate.cfg.xml, otherwise I’m not allowed to create a database like in your initial post here.
Access denied for user ‘xwiki’@’%’ to database 'SubWiki’
But I dont like it to use root as a user in a config
I also changed “root” to “xwiki” as a user after the database creation but than ran into the same “Access denied” Problem.
Should I open an issue or is there already one open ?
Yes, please report a jira issue at Loading... and I’ll try to find a solution. It’s weird that grant all privileges on *.* to xwiki@localhost identified by 'xwiki' is not working. I’ll try it myself. Thanks.
Hope it will help to fix the problem, as the docker container is perfect, also for prod environments.
Everything but the subwiki is running out of the box without the need to configure XX Applications and Configurations :-)
This means the user xwiki accessing MySQL using localhost host, maybe XWiki is using a different host to access the docker based MySQL server ? That’s what the error pasted by @Lange in the Jira issue suggests (it’s reffering to %).
I’ll try it as soon as possible and give feedback.
Do I need to deploy everything new or am I able to take that new compose file to use it in my current installation ? Not sure if the database gets affected badly with it.
It should work with your existing DB. Now you’ll need to docker exec -it <containerid> bash -l into your running DB container and make sure you have the permissions set correctly: mysql -u root -p xwiki and then select * from mysql.user, and verify you have Y set for the xwiki user for all permissions (except the grant one).
Rebooted with Portainer and then it worked.
I’m now trying it with a more complex password. Maybe mysql had a problem with the length or with some escaping character things…