Koozali.org: home of the SME Server

utf8mb4 Mysql Support

Offline HACKERSOFT2011

  • **
  • 31
  • +0/-0
  • HACKERSOFT
    • Adventist International Mission School
utf8mb4 Mysql Support
« on: September 13, 2017, 11:34:42 AM »
Hi!

Is there any way smeserver can support utf8mb4 as the default character set?

e.g.

The following settings are recommended by moodle 3.2+ in the my.cnf file:

[client]
default-character-set = utf8mb4

[mysqld]
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake

[mysql]
default-character-set = utf8mb4

Thank you in advance for your informative reply!


Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: utf8mb4 Mysql Support
« Reply #1 on: September 13, 2017, 12:15:48 PM »
if the onboard mysql release supports such a configuration, you can achieve it using custom fragments (wiki will tell you more)

Offline ReetP

  • *
  • 3,952
  • +6/-0
Re: utf8mb4 Mysql Support
« Reply #2 on: September 13, 2017, 03:34:52 PM »
Funnily enough I stumbled on this today.

I believe the sort answer is no, the default install on mysql in CentOS 6 does not support utf8mb4. I think it started around MySQL 5.3.x

A couple of solutions.

1. Use utf8 if you have a simple charset and don't expect anything convoluted

2. Check the wiki on how to install a newer version of MySQL e.g. SCL repos https://wiki.contribs.org/Software_Collections:MySQL

B. Rgds
John
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline HACKERSOFT2011

  • **
  • 31
  • +0/-0
  • HACKERSOFT
    • Adventist International Mission School
Re: utf8mb4 Mysql Support
« Reply #3 on: September 15, 2017, 09:36:00 AM »
Thanks all for your reply!

@Stefano
I tried adding it to the my.cnf fragments but it won't work..


@ReetP
I think I have MySQL version 5.5.47 by Remi installed.

We are in Thailand with International students so I think the utf8mb4 is best for us. Also, Moodle might deprecate support for utf8 later so we better do it now than when we have too much data to convert later.

Regarding SCL, I will try that one...



Offline ReetP

  • *
  • 3,952
  • +6/-0
Re: utf8mb4 Mysql Support
« Reply #4 on: September 15, 2017, 03:58:39 PM »
If you have the REMI version I would think it should work unless it is compiled without ?

Not sure how to test.

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: utf8mb4 Mysql Support
« Reply #5 on: September 16, 2017, 01:27:25 PM »
I have mysql55 installed on my system as described in the "SME Server 9.x 64-bit ONLY" section of this wiki page:
https://wiki.contribs.org/Software_Collections:MySQL55


I did this, which did not generate any error messages ;-)

I don't know if you also need to change the setting for 'server character set' manually, or of the moodle install takes care of that for you.

Stop mysql55
sv d mysql55-mysqld

edit /opt/rh/mysql55/root/etc/my.cnf to include the moodle settings
[mysqld]
log-error=/var/log/mysql55-mysqld.log
pid-file=/opt/rh/mysql55/root/var/run/mysqld/mysqld.pid
basedir=/opt/rh/mysql55/root/usr
datadir=/opt/rh/mysql55/root/var/lib/mysql
socket=/var/lib/mysql/mysql55.sock
skip-networking
#no port as skip-networking
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix


log-error=/var/log/mysql55-mysqld.log
max_allowed_packet=16M
user=mysql

[mysqld_safe]

[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4



restart mysql55
sv u mysql55-mysqld

check the server status
# mysql55 -e "status;"

Which now gives this output ('Client' and 'Conn.' characterset have changed from utf8 to utf8mb4)
Code: [Select]
-------------
/opt/rh/mysql55/root/usr/bin/mysql  Ver 14.14 Distrib 5.5.52, for Linux (x86_64) using readline 5.1

Connection id: 3
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.52 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db     characterset: latin1
Client characterset: utf8mb4
Conn.  characterset: utf8mb4
UNIX socket: /var/lib/mysql/mysql55.sock
Uptime: 4 min 30 sec

Threads: 2  Questions: 38  Slow queries: 0  Opens: 34  Flush tables: 1  Open tables: 27  Queries per second avg: 0.140
--------------


[EDIT]
/opt/rh/mysql55/root/etc/my.cnf is templated, so ultimately you'll need to effect the above changes using custom template fragments in /etc/e-smith/templates-custom/opt/rh/mysql55/root/etc/my.cnf
« Last Edit: September 16, 2017, 01:34:44 PM by mmccarn »

Offline HACKERSOFT2011

  • **
  • 31
  • +0/-0
  • HACKERSOFT
    • Adventist International Mission School
Re: utf8mb4 Mysql Support
« Reply #6 on: November 15, 2017, 09:50:30 AM »
Just got the time to test this again...

Thanks mmccarn!

Your tweak worked!


Offline Jean-Philippe Pialasse

  • *
  • 2,912
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: utf8mb4 Mysql Support
« Reply #7 on: November 15, 2017, 03:01:03 PM »
have you installed it manually or using the contrib ?

if the latter your changes might be deleted later. You need to template them.

https://wiki.contribs.org/MySQL55

Offline HACKERSOFT2011

  • **
  • 31
  • +0/-0
  • HACKERSOFT
    • Adventist International Mission School
Re: utf8mb4 Mysql Support
« Reply #8 on: November 15, 2017, 03:03:41 PM »
Thank you! I tested it first by modifying the /etc/my.conf file...

I will set it in the template fragment so it can survive an update...

Thanks again!