
Username The username to access your database. We do however need to set several arguments in order to clean up the charsets and provide a dump that is not going to cause you any problems if you are moving this database to a different database server or find yourself having to restore on a reverted system. The first step is of course to dump out the database and of course we will use mysqldump for this. Sed -i.bak2 's/ENGINE=InnoDB/ENGINE=InnoDB ROW_FORMAT=DYNAMIC/' schema.sql This may needed if you use a Mysql version inferior to 5.7 (or in Debian 9 with MariaDB 10.0.30).Sed -i.bak -e 's/DEFAULT CHARACTER SET latin1/DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci/' -e 's/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8mb4/' schema.sql Depending your situation, you may have to change latin1 to utf8.%s/DEFAULT CHARACTER SET latin1/DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci/ %s/DEFAULT CHARSET=latin1/DEFAULT CHARSET=utf8mb4/ wq Mysqldump -uusername -ppassword -c -e -default-character-set=utf8mb4 -single-transaction -skip-set-charset -add-drop-database -B dbname > dump.sql $ php admin/cli/mysql_collation.php -collation=utf8mb4_unicode_ci The maximum column size is 767 bytes.Īdditional note: There is a conversion script available if your site is not extremely big. Note : you must add theses settings in your my.cnf, to avoid these error : #1709 - Index column size too large. If you have previously installed Moodle and are now getting the error the following process will allow you to convert your database. You can simply run the below query in your database to resolve the issue.Īlter database mydatabasename charset=utf8mb4 If you have created your database schema and are receiving the error during your initial installation your Moodle database will still be empty. The difference is described in the unicode documentation page. Utf8mb4_unicode and utf8mb4_general are not the same but similar. skip-character-set parameter, will restore the database with your new default character set of utf8mb4.

Having made your default character set utf8mb4, a mysqldump restore of your database with the To make mysql default to utf8 you can edit /etc/my.cnf as follows.įor ubuntu server lucid 10.04 2.6.32-24-server Jan 2011įor Debian GNU/Linux 9.0 - MariaDB 10.0.30-MariaDB-0+deb8u2. The descriptions elsewhere in this section cover making the utf8 database versions using mysqldump. It is a database engine that is very widely used in open source projects and it contains details of all the stuff in your Moodle such as usernames etc and pointers to all the files that have been uploaded to it.ġ) Change your mysql to have utf8mb4 as its character set and It is perhaps worth noting that Mysql is nothing to do specifically with Moodle. Details about four byte UTF-8 can be found at MySQL_full_unicode_support.

Since Moodle 3.1 we now use four byte UTF-8 by default.
MYSQL CREATE DATABASE UTF8 GENERAL CI INSTALL
However the UTF8 check during install and upgrade was only been implemented in Moodle 2.0 and you may find you are unable to upgrade because your database was not set up originally as utf8 when you first installed Mysql or because you have been running Moodle since before 1.8 and haven't previously converted your database. Moodle requires UTF8 in order to provide better multilingual support and has done since Moodle 1.8.

If you are upgrading, you should perform the UTF-8 migration process (see the Admin page). New installations must be performed into databases that have their default character set as Unicode. It is required that you store all your data in Unicode format (UTF-8). You may see the following error when upgrading your Moodle. 4.3 Special chars won't import correctly.

