Installation

moving to MariaDB

moving to MariaDB

by Alex Jordan -
Number of replies: 6

I've installed MariaDB (apt install mariadb-server) and that seems to have been successful.

Now I am trying to install DBD::MariaDB using MCPAN. I get:

cpan[1]> install DBD::MariaDB
Reading '/root/.cpan/Metadata'
  Database was generated on Wed, 16 Jun 2021 01:29:02 GMT
Running install for module 'DBD::MariaDB'
Checksum for /root/.cpan/sources/authors/id/P/PA/PALI/DBD-MariaDB-1.21.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE
Configuring P/PA/PALI/DBD-MariaDB-1.21.tar.gz with Makefile.PL

Cannot find the file 'mariadb_config' nor 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mariadb_config or mysql_config. Resorting to guessed values!

PLEASE NOTE:

For 'make test' to run properly, you must ensure that the
database user 'root' can connect to your MariaDB or MySQL server
and has the proper privileges that these tests require such
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others.

mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';

You can also optionally set the user to run 'make test' with:

perl Makefile.PL --testuser=username

Failed to determine directory of mysql.h. Use

perl Makefile.PL --cflags=-I<dir>

to set this directory. For details see DBD::MariaDB::INSTALL,
section "C Compiler flags" or type

perl Makefile.PL --help
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
PALI/DBD-MariaDB-1.21.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
PALI/DBD-MariaDB-1.21.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512



This doesn't seem right. How can I get it to find those config files? "Resorting to guessed values" is not working out. If I try to go to the admin course for example, I get:

error instantiating DB driver WeBWorK::DB::Driver::SQL for table achievement_user: install_driver(MariaDB) failed: Can't locate DBD/MariaDB.pm in @INC (you may need to install the DBD::MariaDB module) (@INC contains: /opt/webwork/pg/lib /opt/webwork/webwork2/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /etc/apache2) at (eval 996) line 3. Perhaps the DBD::MariaDB perl module hasn't been fully installed, or perhaps the capitalisation of 'MariaDB' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Mem, Proxy, Sponge, mysql. at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 79. at /opt/webwork/webwork2/lib/WeBWorK.pm line 317.

In reply to Alex Jordan

Re: moving to MariaDB

by Alex Jordan -

After going down too many roads to recount here, I was able to return my server to using mysql 5.7 and I will just leave it at that for now. Shout out to Danny who helped me out.

In the end, I completely reinstalled mysql. Then I placed a backup of my /var/lib/mysql folder back in place at /var/lib/mysql. It appears that with active courses and new courses, things are working.

However now when I unarchive an old course, it has database structure errors and won't initially load. I can use the admin course to update the course I unarchived. But the course has lost its users and problem sets. I had to use the command line wwsh to add myself back into the course, where I can get in to see that these things are missing. Files form the course are still there, it's just the database elements that are gone.

A less concerning issue is that I seem to not be able to use extended characters. I tried creating a course where the title had an em dash — in its title. There was no error, but then that course's title appeared with some accented letter a in place of the em dash. So character encoding is not behaving as hoped for.


In reply to Alex Jordan

Re: moving to MariaDB

by Danny Glin -

I can't offer too much help since my system is still running 2.14, and I haven't braved the migration to UTF8.

It sounds like there is something going on with the character sets between your existing courses and the new version of WeBWorK.

There are two pieces to this:

  1. Changing the default character set for the database
  2. Changing the tables themselves to use the new character set (utf8mb4)

There are two ways to accomplish this:

  1. By manually following the instructions at https://webwork.maa.org/wiki/Converting_the_webwork_database_from_the_latin1_to_the_utf8mb4_character_set
  2. Using the upgrade-database-to-utf8mb4.pl script, which can be found in the /opt/webwork/webwork2/bin directory

I recommend doing a mysqldump of your whole database before trying any of these changes, as it is possible that some of these adjustments to the database may be hard to undo if need-be.

In reply to Alex Jordan

Re: moving to MariaDB

by Alex Jordan -
This more serious issue I have (about archiving/unarchiving courses) seems now to be separate from my recent databse woes. I am experiencing the same thing on two other 2.16 servers. Either something is not right with version 2.16, or I have failed to update database configuration settings in the right way.

On my 2.16 servers, if I attempt to archive a course, I get:

Warning messages

Use of uninitialized value $var in hash element at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 285.


The same error message comes up if I attempt to unarchive a course. (Which is the main issue that led me to start this thread, but at the time I thought that was a symptom of my attempt to move to MariaDB.)
In reply to Alex Jordan

Re: moving to MariaDB

by Michael Gage -

I'm using webwork-2.16 in a docker container and I can't duplicate the error you are seeing when archiving.  I don't see a warning on the  html page and I don't see a warning in the apache logs either.

In reply to Alex Jordan

Re: moving to MariaDB

by Ama Chefe -

According to the HowTo https://metacpan.org/dist/DBD-MariaDB/view/lib/DBD/MariaDB/INSTALL.pod#CPAN-installation, you need to install MariaDB Connector/C, which is a dependency.

$ sudo apt install libmariadb3 libmariadb-dev

After that go ahead and install DBD::MariaDB using MCPAN.