Nethserver Moodle from Wiki

In this case the root password of mariadb needs to be resetted:

Stop service:

systemctl stop rh-mariadb103-mariadb

Enable rh-mariadb103 scl:

scl enable rh-mariadb103 bash

Start mariadb in a way to be able to reset the password:

mysqld_safe --skip-grant-tables &

Enter mariadb103 client:

mysql103

Reset the password, replace with the password from the my.cnf:

UPDATE mysql.user SET authentication_string = PASSWORD('<PASSWORD from my.cnf>') WHERE User = 'root' AND Host = 'localhost';
FLUSH PRIVILEGES;
quit
exit

Stop and start the service:

mysqladmin103 shutdown
systemctl start rh-mariadb103-mariadb

Now the following should work without error:

mysql103

Sorry for bothering you, but his is not “my world” - I do not have any know how on this and it is getting wired:

Takes so many time that I press enter - in this case the command returns to shell. I proceed with the commands as given above.

ERROR 1146 (42S02): Table ‘mysql.user’ doesn’t exist

Job for rh-mariadb103-mariadb.service failed because the control process exited with error code. See “systemctl status rh-mariadb103-mariadb.service” and “journalctl -xe” for details.

…

How can I check if mariaDB103 is correctly installed?

No problem, we’ll find a solution.

You may press enter immediately, there’s no need to wait. The command before runs the process in background.

This table should exist in any case, it seems there’s an issue with the mariadb installation.

Please check output of

systemctl status rh-mariadb103-mariadb.service -l

and also check the mariadb logfile /var/log/rh-mariadb103/mariadb.log.

To reset mariadb 10.3 to default (like reinstall):

Stop service:

systemctl stop rh-mariadb103-mariadb

Delete database files:

rm -rf /var/opt/rh/rh-mariadb103/lib/mysql/*

Reinitialize mariadb:

signal-event nethserver-rh-mariadb103-update

After deleting all databases, at least moodle should be reconfigured to regenerate the moodle db:

signal-event nethserver-moodle-update

1 Like

Success! that one worked - at least I can mariadb via phpmyadmin. Also the moodle plattform is online, up and running, and it is accessible from the vhosts as expected.

However, there is just one more thing to do:
I can not log in to moodle. Obviously the DB was not transferred. The login with username admin and password Nethesis,1234 or with an AD/LDAP user does not work. Also my old admin password does not work either. Is there any regular access to the DB?

Can I simply restore the old DB from the old mariadb 5 installation?

The DB is not transferred, you need to do it manually.

If there’s no database nethserver-moodle creates one and sets the default password. Did you create a db manually?

I didn’t test it but it should work to export/import the database.

If something goes wrong, you can always go back to a fresh moodle by deleting the moodle database and running

signal-event nethserver-moodle-update

I can not exactly remember, but to the best of my knowledge I did the installation exactly as it was given on the wiki. I am quite sure that I did not alter the password during installation. If it was Nethesis,123 intially, I changed it afterwards.

Also, you will not believe what happens here:

I can login via phpmyadmin on port 3313 using either user “admin” or “root”. For both the passwort as given in /root/.my.cnf is valid. But I am not admin. I can not access the user nor can I restore the dump.

Maybe a browser cache issue…did you try to refresh or use another browser?

Yes, of course - but I was searching the DB (for which I have read access): It does contain all my AD users from Nethserver - which I never set up within the old moodle installation. I can not even remember that I have the the ldap access.

Yes, nethserver-moodle syncs the ldap users to the moodle db.

Ok, but how do I re-gain admin access either to the mariadb103 or to moodle.

by the way - I just tried
UPDATE mdl_user SET password=MD5(‘admin’) WHERE username=‘admin’;

It did change the admin-password, but again, I can not login

Did you try the LDAP admin password?

Maybe phpmyadmin needs to be reconfigured?

signal-event nethserver-phpmyadmin-update

Does entering mariadb 10.3 client with

mysql103

work now? Then the root access to mariadb 10.3 is ok.

Please delete the moodle database to recreate the db once more with hopefully working passwords.

drop database moodle;

exit

Recreate:

signal-event nethserver-moodle-update

EDIT:

Maybe the CLI way works to reset the password:

sudo -u apache /opt/rh/rh-php73/root/usr/bin/php /usr/share/moodle/admin/cli/reset_password.php

I am not sure, I am just running the commands as given above.

but One thing is funny - there is a password reset funtion on the moodle site.
here I enter the eMail

root@nethservername.mydomain.tld

and I get a linkt to reset the admin passwort - that works and I am logged in. But funny - after loggin out I can not log in anymore ???

This is really weird.

works

works (followed by exit, of course)

works

but again - no change to login …

I tried to reinitialize mariadb 10.3 as explained here but mysql and perfomance_schema tables are not created. Does anybody know what could be the issue here?

use mysql_install_db command (backup/dump any other existing database/table beforehand).
I guess it’s advisable to run the signal event (signal-event nethserver-rh-mariadb103-update) afterwards.

2 Likes

We tried mysql_install_db including the signal-event and it adds the tables but they’re empty. And after another recreate the tables are missing again.
I cannot reproduce this behaviour on one of my servers, it’s really weird. When I delete the databases dir, they’re always recreated.

Maybe it’s a permission problem…

@thorsten, could you compare the permissions?

[root@testserver ~]# ls -l /var/opt/rh/rh-mariadb103/lib/mysql/
total 122940
-rw-rw---- 1 mysql mysql    16384 Apr 26 23:29 aria_log.00000001
-rw-rw---- 1 mysql mysql       52 Apr 26 23:29 aria_log_control
-rw-rw---- 1 mysql mysql      976 Apr 26 23:29 ib_buffer_pool
-rw-rw---- 1 mysql mysql 12582912 Apr 26 23:29 ibdata1
-rw-rw---- 1 mysql mysql 50331648 Apr 26 23:29 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 Apr 26 23:29 ib_logfile1
-rw-rw---- 1 mysql mysql 12582912 Apr 26 23:29 ibtmp1
-rw-rw---- 1 mysql mysql        0 Apr 26 23:29 multi-master.info
drwx------ 2 mysql mysql     4096 Apr 26 23:29 mysql
-rw-rw---- 1 mysql mysql       16 Apr 26 23:29 mysql_upgrade_info
drwx------ 2 mysql mysql       20 Apr 26 23:29 performance_schema
drwx------ 2 mysql mysql     4096 Apr 26 23:29 phpmyadmin
-rw-rw---- 1 mysql mysql    24576 Apr 26 23:29 tc.log

[root@testserver ~]# ls -ld /var/opt/rh/rh-mariadb103/lib/mysql/
drwxr-xr-x 5 mysql mysql 266 Apr 26 23:29 /var/opt/rh/rh-mariadb103/lib/mysql/
2 Likes

@stephdl

Do you have any idea to re-set up / re-install mariadb103 ?

@mrmarkuz

Markus, what do you think about a complete uninstall of mariadb103 / moodle? Afterwards I would give it another try… Can not even get worse…

How would I do so?

sorry, forget to answert to this - no the the rights are correct as given herein - at least if the db file is existent.