[MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Discussion on apps, protocols, APIs, specifications, and more. You are welcome to join us as a TOS app developer!
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

OK, I have just realised that MariaDB has been installed in various actual locations/drives on the system. Not sure how it happened, but I think this is the source of the problem.

I have a MariaDB installation in

Code: Select all

/mnt/md0/appdata/MariaDB_DB/
where all the Nextcloud tables are listed.

On the other hand, there is a MariaDB installation in

Code: Select all

/mnt/md2/appdata/MariaDB_DB/
This area is practically empty, containing only the default tables, etc, etc.

How do I get the system and Nextcloud to look at the correct installation of MariaDB?
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

I was able to partly resolve this.

My.cnf in

Code: Select all

/usr/local/MariaDB/bin/MariaDB
read that the data directory is in:

Code: Select all

datadir=/mnt/appdata/MariaDB_DB
But is /mnt/appdata a real folder? It is not! It is a symlink.

Where was the symlink pointing to?

Code: Select all

[root@TNAS-17FF MariaDB]# ls -l /mnt/appdata
lrwxrwxrwx 1 root root 11 Feb 23 23:21 /mnt/appdata -> md2/appdata
Why on earth is this folder now pointing to md2 when I know for a fact I install all of my apps on md0? This is a mystery.

I move the symlink to the correct location, but it doesn't work. It needs to be a relative symlink. I delete the link and recreate it as a relative link and now MariaDB is working well. Nextcloud is also restored.

However, this means there is still a MariaDB installation on md2 that I neither need nor want. I have no idea how it got there and I need to make sure it does not interfere with future updates. Open to all suggestions.
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

Upgraded to TOS 5. New user, new installation of MariaDB. phpmyAdmin starts normally. MariaDB refuses to start.

No errors in the log.

Checking services, I have:

Code: Select all

[username@TNAS-17FF init.d]# service MariaDB status
[DEBUG /etc/init.d/MariaDB status]
[DEBUG ln: failed to create symbolic link '/usr/local/lib/libtinfo.so.5': No such file or directory
cat: /Volume1/MariaDB_DB/mysqld.pid: No such file or directory
]
MariaDB is stopped.
phpMyAdmin (pid 17393)is running

[username@TNAS-17FF init.d]# service MariaDB restart
[DEBUG /etc/init.d/MariaDB restart]
ln: failed to create symbolic link '/usr/local/lib/libtinfo.so.5': No such file or directory
: exit status 1
Looks like something did not go well during the installation and the service was not set up properly?

I reinstalled, but same issue. What do you suggest I look at next?
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by outkastm »

It seems this issues appear on the latest TOS5 version when using the internal TOS start/stop function.
Normally you should be able to start the app using

Code: Select all

/etc/init.d/MariaDB start
Or by going to app WebUI and then from menu Application Control >> Start

I will have a look an try to fix the autostart asap
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

Ok, so I don't know if anyone else is affected on the latest version of TOS 5.1 (I am on 5.1.24), but after days of investigating, I was able to figure out what goes wrong with the installation of this module. Please remember that this is a new, clean installation of TOS 5.1 with no prior files from a previous installation of TOS 4 interfering.

1. Installation completes successfully, myphpAdmin starts, but MariaDB falls flat.
2. Nothing in the error log under Support & Help within the "installed apps" area.
3. MariaDB starts normally when started manually from within /usr/local/MariaDB/bin/MariaDB/bin with a completely custom my.cnf.
4. The issue therefore is with the /etc/init.d/MariaDB script.
5. The script is trying to create a symlink to

Code: Select all

/usr/local/lib/libtinfo.so.5
when the directory does not exist.

I got around this by creating the directory "lib" in /usr/local/. I suspect this is not the right thing to do and the script is trying to create the symlink in /usr/lib, but at least

Code: Select all

mkdir /usr/local/lib
works.

6. The installation created folder

Code: Select all

/home/username/MOD_CONFIG/MariaDB
which also contains my.cnf, but there is no indication that the script is looking there to obtain the correct my.cnf parameters. It rather uses

Code: Select all

/usr/local/MariaDB/config/my.cnf
, which begs the question as to why the file in the Home folder exists at all and what good it is.

7. The installation created folder /Volume1/tmp and it urges MariaDB to use that folder for tmp. It sets permissions correctly but it does not set ownership. The only way for MariaDB to actually run was to

Code: Select all

chown -R mysql:mysql /Volume1/tmp
Overall a very frustrating experience to get it up and running - changes to the installation tpk are urgently needed.
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by outkastm »

In short answer, there is no issue with /etc/init.d/MariaDB startup script. If you run the script in SSH, both mysql and phpMyAdmin will start.
There is an issue with a TOS utility in the latest version 5.1.24 which lead to fail to start the apps which are using it during boot (see Plex issues also).
For this MariaDB it will mess up the my.cnf file

5. This symlink is not used anymore so even it will not be created, the app will run correctly

Code: Select all

/usr/local/lib/libtinfo.so.5
6. The app is looking for config files in

Code: Select all

/usr/local/MariaDB/config
That is a symlink to

Code: Select all

/home/superuser/MOD_CONFIG/MariaDB
The reason behind that is because during a TOS reinstallation, the apps installation folder are removed ( /usr/local/MariaDB ). This include the config files.

By using the symlink, the config files are kept and only the symlink is removed in case of TOS reinstallation.
Also using the home folder, the config files and logs can be accessed from TOS for non experienced users.

7. This temporary folder doesnt have to be owned by mysql user/group. It is also used by some other modules which runs under different user.
Is enough to be writable by mysql.
Doing these modification on your own you will risk to have issues with other apps

Code: Select all

/Volume1/tmp
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

This is the only way I could get the module to work after a great deal of trial and error as it did not work out of the box, as expected.

The symlink you are describing to /home/username/MOD_CONFIG/MariaDB does not get created in my case - at all (I must have installed at least 5 or 6 times).

httpd.conf and httpd-ssl.conf are completely uneditable from within the module. I need to go into the physical file to edit.
User avatar
sanctimon
Posts: 98
Joined: 14 Nov 2021, 06:57

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by sanctimon »

Happy to arrange a screen-share, if you have the time and inclination.
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by outkastm »

yes we can,

I have to test first the latest TOS 5.1.29, to see if my reported issue is fixed.

Maybe we can do a share screen later this evening or tomorrow
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [MariaDB] MariaDB+phpMyAdmin MySQL Server Fork

Post by outkastm »

sanctimon wrote: 24 Mar 2023, 21:04 This is the only way I could get the module to work after a great deal of trial and error as it did not work out of the box, as expected.

The symlink you are describing to /home/username/MOD_CONFIG/MariaDB does not get created in my case - at all (I must have installed at least 5 or 6 times).

httpd.conf and httpd-ssl.conf are completely uneditable from within the module. I need to go into the physical file to edit.
If only httpd.conf and httpd-ssl.conf were not editable from within the app UI, it means the symlink should be correctly created.
These 2 files were still pointing to the old path from TOS4, this is now fixed in latest version

The TOS5 utility issue is still not fixed on the latest firmware, so i made a workaround to avoid the issue with MariaDB if is the case.

You can download an test the latest version, if still issue send the MariaDB_start.log file

Make sure the Volume is present in my.cnf file options. If not, either you add it yourself or delete completely the my.cnf file to be recreated during the next start. That is an issue generated by not working TOS utility

Image
Post Reply