after setting all config file and runtime options for charset that i can find to utf-8, new mysqli connections made with php still has its charset set to latin1, which effective
I know this is a very old thread, but I just encountered this issue on my Fedora 30 KDE laptop after installing MariaDB (and have spent over an hour looking for the answer). On my Ubuntu 18.04 server, everything just works without having to modify any config files, but on my laptop running Fedora 30 KDE, I had to:
$ sudo vi /etc/my.cnf.d/client.cnf
and then added default-character-set
in the [client-mariadb]
section:
[client-mariadb]
default-character-set = utf8mb4
I had to do the same for the server config:
$ sudo vi /etc/my.cnf.d/mariadb-server.cnf
and then added the following in the [mysqld]
section:
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
Then just restart MariaDB:
$ sudo systemctl restart mariadb.service
After this, there's no need to explicitly set the character set within PHP scripts.