MySQL

connect

my $dbh = DBI->connect(
    qq[DBI:mysql:database=$self->{cfg}->{MYSQL}->{db};host=$self->{cfg}->{MYSQL}->{host};port=$self->{cfg}->{MYSQL}->{port}],
    $self->{cfg}->{MYSQL}->{username},
    $self->{cfg}->{MYSQL}->{password},
    {   RaiseError             => 1,
        PrintWarn              => 0,
        ShowErrorStatement     => 1,
        mysql_auto_reconnect   => 1,
        mysql_enable_utf8mb4   => 1,
        mysql_multi_statements => 1,
    }
);

create table

CREATE TABLE IF NOT EXISTS `table` (
    `id` VARCHAR(20) NOT NULL,
    PRIMARY KEY (`player_id`)
) DEFAULT CHARSET=utf8mb4;