I don’t seen to be able to get ONLYOFFICE Document Server to work with MariaDB, I have a local database that works with the settings from /etc/onlyoffice/documentserver/local.json
, for example:
{
"services": {
"sql": {
"dbHost": "localhost",
"dbName": "onlyoffice",
"dbPass": "C3mbo3P5PZZ10mlNSsOY",
"dbPort": "3306",
"dbUser": "onlyoffice",
"type": "mariadb"
}
}
mysql -hlocalhost -uonlyoffice -pC3mbo3P5PZZ10mlNSsOY onlyoffice -e "SHOW TABLES"
+----------------------+
| Tables_in_onlyoffice |
+----------------------+
| doc_changes |
| task_result |
+----------------------+
But in /var/log/onlyoffice/documentserver/docservice/out.log
I have:
[2023-04-20T14:54:41.943] [WARN] [localhost] [docId] [userId] nodeJS - Express server starting...
[2023-04-20T14:54:41.947] [WARN] [localhost] [docId] [userId] nodeJS - Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability
[2023-04-20T14:54:42.086] [ERROR] [localhost] [docId] [userId] nodeJS - pool.getConnection error: Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3306,
fatal: true
}
[2023-04-20T14:54:42.090] [ERROR] [localhost] [docId] [userId] nodeJS - getTableColumns error: Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16)
I suspect it is because ONLYOFFICE is trying to connect to 127.0.0.1
rather than localhost
:
mysql -h127.0.0.1 -uonlyoffice -pC3mbo3P5PZZ10mlNSsOY onlyoffice -e "SHOW TABLES"
ERROR 2002 (HY000): Can't connect to MySQL server on '127.0.0.1' (115)
Check the name resolution:
dig A localhost +short
127.0.0.1
dig AAAA localhost +short
::1
The same with IPv6:
mysql -h::1 -uonlyoffice -pC3mbo3P5PZZ10mlNSsOY onlyoffice -e "SHOW TABLES"
ERROR 2002 (HY000): Can't connect to MySQL server on '::1' (115)
I think using localhost
results in the socket at /var/run/mysqld/mysqld.sock
being used for the the connection and not TCP/IP, can ONLYOFFICE use the socket or do I need to enable MariaDB to allow TCP/IP connections? However the user is set to use password auth:
mysql -e "SELECT User,Host,plugin from user WHERE User='onlyoffice'" mysql
+------------+-----------+-----------------------+
| User | Host | plugin |
+------------+-----------+-----------------------+
| onlyoffice | localhost | mysql_native_password |
+------------+-----------+-----------------------+
I 've also tried creating a ~/.my.cnf
file for the ds
user:
ls -lah /var/www/onlyoffice/documentserver/.my.cnf
-rw-r----- 1 root ds 113 Apr 20 17:04 /var/www/onlyoffice/documentserver/.my.cnf
cat /var/www/onlyoffice/documentserver/.my.cnf
[client]
host="localhost"
user="onlyoffice"
password="C3mbo3P5PZZ10mlNSsOY"
database="onlyoffice"
su - ds -s /bin/bash
mysql -e "show databases"
+--------------------+
| Database |
+--------------------+
| information_schema |
| onlyoffice |
+--------------------+
I’ve tried adding an additional user account:
mysql -e "CREATE USER 'onlyoffice'@'127.0.0.1' IDENTIFIED BY 'C3mbo3P5PZZ10mlNSsOY'" mysql
mysql -e "GRANT ALL PRIVILEGES ON onlyoffice.* TO 'onlyoffice'@'127.0.0.1'" mysql
mysql -e "SELECT User,Host,plugin from user WHERE User='onlyoffice'" mysql
+------------+-----------+-----------------------+
| User | Host | plugin |
+------------+-----------+-----------------------+
| onlyoffice | localhost | mysql_native_password |
| onlyoffice | 127.0.0.1 | mysql_native_password |
+------------+-----------+-----------------------+
But a service ds-docservice restart
results in the same error being written to /var/log/onlyoffice/documentserver/docservice/out.log
.