Gossamer Forum
Quote Reply
MariaDB?
Has anyone switched over to MariaDB with links and are there any issues? Thanks!
Quote Reply
Re: [socrates] MariaDB? In reply to
Does GLinks even support it? Can't say I've ever used it, but I do tend to stick with mySQL.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MariaDB? In reply to
Quote:
but I do tend to stick with mySQL.
mysql is ok for now but I heard that it is not being updated anymore and most hosts are providing MariaDB as an alternative and (supposedly it is compatible with mysql). I also heard cpanel will soon remove mysql support or something like that.
Quote Reply
Re: [socrates] MariaDB? In reply to
Ah I wasn't aware they were stopping development of mySQL. I guess GT would need to comment on this, as I don't think it's even an option in the GT libs?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [socrates] MariaDB? In reply to
More or less a comment for myself or maybe someone reading this.
I am about to move to another server and I still don´t want to let go from LinksSQL.
It looks like MariaDB works more or less with LinksSQL.
I modified two things in MYSQL:.pm but the rest looks good for now.

Code:
-return $self->{sth}->{mysql_insertid} || $self->{sth}->{insertid};
+return $self->{sth}->{mariadb_insertid} || $self->{sth}->{insertid};

Code:
+$connect->{driver_to_connect} = 'MariaDB';
$connect->{host} ||= 'localhost';
$connect->{port} = undef if $connect->{host} eq 'localhost';#new MariaDB
$self->{driver} = $connect->{driver};
-$dsn = "DBI:$connect->{driver}:";
+$dsn = "DBI:$connect->{driver_to_connect}:";

This was a shortcut avoiding to make a MARIADB.pm file.

Regards
n||i||k||o
Quote Reply
Re: [el noe] MariaDB? In reply to
Hey Niko,

Thank you for posting this, I appreciate it :).

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] MariaDB? In reply to
Thanks a lot for your feedback Smile
Quote Reply
Re: [el noe] MariaDB? In reply to
Hmm are you sure this is needed? I've been using MariaDB quite happily for ages, and can't say I've noticed any problems with it. It seems like mysql_insert_id is valid:

https://mariadb.com/kb/en/mysql_insert_id/

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MariaDB? In reply to
I got an error which made me investigate and try to solve it the above way.
I guess that maybe you work with a MariaDB database but use the. DBI:mysql driver.
The modification switches to DBI:MariaDB.
I had issues with special characters (Umlaute but also ndash and mdash) that probably won´t affect you.

The connection from the new server to the database of the GT server which I could solve by using:

Code:
$CONN{$conn_key}->{mysql_enable_utf8} = 1;
in Driver.pm.

On the new server with the old data I came up with the DBI:MariaDB.
At the moment everything seems to work fine and I hope I did not mess everything up in long terms.

Last edited by:

el noe: Mar 15, 2024, 5:46 AM
Quote Reply
Re: [el noe] MariaDB? In reply to
For UTF8, I just add this into GT::SQL::Driver::MYSQL.pm:

Code:
sub connect {
# -----------------------------------------------------------------------------
# Override connect to set up the connection character set for new MySQL's that
# have switched to using UTF-8 as the default.
#
my $self = shift;

# MySQL 5.5+ switches from using the compiled in default (usually latin1)
# to the system LANG/LC_ALL setting (which is typically UTF-8). Switch to
# using latin1 for backwards compatibility.
$self->{charset} ||= 'latin1';
#$self->{charset} ||= 'utf8';

my $initialized = $self->{dbh} ? 1 : 0;

my $dbh = $self->SUPER::connect($@);
if ($dbh and not $initialized and $self->{charset}) {
$self->debug("Setting up MySQL connection character set to: $self->{charset}") if $self->{_debug};
# $dbh->{mysql_enable_utf8} = 1 if lc $self->{charset} eq 'utf8';
# $dbh->do("SET NAMES '$self->{charset}'");
}

$dbh->{mysql_enable_utf8} = 1;
$dbh->do("SET NAMES 'utf8'");



return $dbh;
}

And also in GT::SQL::Table.pm


Code:
sub new {
...
$self->do_query("SET NAMES 'utf8'");

$self->debug("Table '$self->{name}' object created.") if ($self->{_debug} > 2);
return $self;
}

That seems to work for me with MariaDB and UTF8 :)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MariaDB? In reply to
That´s probably right, but I still have latin1 databases plus it seemed nice to me to use the DBI:MariaDB setting for MariaDB.
But now we have a nice post that helps me if I migrate to utf8 someday :)
Quote Reply
Re: [el noe] MariaDB? In reply to
Yeah, migrating an old setup to utf8 is a bit of a pain! I had to do a site conversion for someone recently, as we wanted to go "full utf8"... but it requires quite a lot of tweaks to existing tables (due to data lengths etc). Its worth it in the end though! (the templates were also a bit tricky to get working properly with utf8 versions)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] MariaDB? In reply to
Hope you are still around when the day of utf8 comes for me.
Kind of miss the old GT staff and the spirit of the company.
I am a little wistful today, just removed all my remaining data from the good old GT server in UK.
The last link to the original Links ... besides this forum and the last couple of people hanging out here.