1

I'm brand new to containers and am trying to set up a MediaWiki on a Synology NAS. The Synology comes with a package for MediaWiki but it is at 1.30 and they haven't updated in a year. I need a newer version so i can use LDAP with latest extensions.

So, i found this step-by-step guide on how to install the containers with docker. I'm trying it with MediaWiki 1.34.0 and it works fine up to the point that we test connection to the mysql database - 5) Input your MySQL container name and its root password.

When i click Continue i get this error: Cannot access the database: :real_connect(): (HY000/2054): The server requested authentication method unknown to the client. Check the host, username and password and try again. If using "localhost" as the database host, try using "127.0.0.1" instead (or vice versa).

It seems to be that the mediawiki container and the mediawiki-mysql containers aren't networked. I'm looking under network and it shows the following, so they should be able to communicate. I can ping a 172.26.0.2 and 172.26.0.3 address but can't figure how to get past step 5) in that go-by.

enter image description here

I've tried everything i can think of. Using older versions of MediaWiki (e.g. 1.31) and mysql but this connection problem is the sticking point each time. I've reached limit of my capabilities here.

Community
  • 1
  • 1
relayman357
  • 793
  • 1
  • 6
  • 30

2 Answers2

1

It seems to be that the mediawiki container and the mediawiki-mysql containers aren't networked

Would be interesting where this assumption is coming from. From what I read from the error message, your containers can perfectly fine communicate to each other (they should, as they seem to be on the same network, given that the mediawiki-mysql container is also on a bridged network and in the same subnet).

Let's take a look at the interesting part of the error message:

The server requested authentication method unknown to the client

That looks, to me, as a misconfiguration of mysql. I assume you're using the latest version of the mysql docker container, which should be some version of mysql 8. If you now google for this, you'll find plenty of posts even on stackoverflow, like: https://stackoverflow.com/a/53881212/3394281 php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

To fix this with your current dataset, you could change the authentication plugin from socket to password:

  1. Log in as root to mysql
  2. Run this sql command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Replace 'password' with your root password. In case your application does not log in to your database with the root user, replace the 'root' user in the above command with the user that your application uses.

Or, if you're using docker-compose or can change the executed command somehow else, you could follow this answer:

Add the following line to the command: --default-authentication-plugin=mysql_native_password

Florian
  • 2,796
  • 1
  • 15
  • 25
  • That did not work. I followed your 1. and 2. above as my first try. Still got `the server requested authentication method...`. Note that when i ran the ALTER USER command from a bash in the mysql container i got the response `Query OK, 0 rows affected (0.22 sec)` – relayman357 Dec 28 '19 at 15:53
  • Next, I then stopped and deleted both containers (mediawiki and mediawiki-mysql) and deleted the network bridge. Then i followed the instructions i link above except i modified the MySQL install command to this: `sudo docker container run -d --name mediawiki-mysql -v mediawiki-mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD= mysql --default-authentication-plugin=mysql_native_password.` Same result...`the server requested authentication method...` error. – relayman357 Dec 28 '19 at 15:54
  • 1
    I probably should've give the hint, that you need to change the authentication plugin for the user you're connecting with :) But you got it already, as you write in your answer. – Florian Dec 28 '19 at 22:42
  • 1
    Thank you sir. Appreciate your help! – relayman357 Dec 28 '19 at 23:46
1

Florian's answer put me on the right trail even though it didn't work as he initially suggested (I'm marking his as correct answer). I changed the root plugin (his item 2. above) but still did not work. So, I did the same on all of the users shown with the SELECT user, authentication_string,plugin,host FROM mysql.user;.

enter image description here

After, that i ran a FLUSH PRIVILEGES; and then was able to complete the MediaWiki 1.34.0 installation (via http://xxx.xxx.xxx.xxx:8080).

I suspect that all i really needed to do was run that ALTER USER on the two root accounts (root@localhost and root@%) but it is working now so i'm leaving it as-is. Here is a good link that will help with these commands.

relayman357
  • 793
  • 1
  • 6
  • 30
  • After various problems with this MediWiki docker install on Synology I contacted Synology tech support. They told me that my approach (ssh into the Synology box and issuing docker commands etc. from bash shell) was not supported. Only using the docker interface via the DSM is supported). Just FYI before you get lost in the weeds. – relayman357 Jan 13 '20 at 01:45