# Converting to utf8mb4

**URL:** <https://help.nextcloud.com/t/converting-to-utf8mb4/62536>\
**Category:** ℹ️ Support\
**Tags:** nc16\
**Created:** [October 22, 2019, 9:11pm UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536 "2019-10-22T21:11:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![notaduck](https://help.nextcloud.com/user_avatar/help.nextcloud.com/notaduck/32/518_2.png) [@notaduck](https://help.nextcloud.com/u/notaduck)\
**Post date:** [October 22, 2019, 9:11pm UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/1 "2019-10-22T21:11:25Z")

</div>

Hi. I recently upgrade from NC 15.x -\> NC 16.x  
I got the warning message about that my MySQL server wasn’t in the best shape and that I should fix it. I followed the link from the warning: [https://docs.nextcloud.com/server/16/admin\_manual/configuration\_database/mysql\_4byte\_support.html](https://docs.nextcloud.com/server/16/admin_manual/configuration_database/mysql_4byte_support.html)

Did exactly as describe, but I’m facing some problems ATM!

```auto
sudo -u www-data php occ maintenance:repair

```

Do I get the following error message.

```auto
root@nextcloud:/var/www/nextcloud# sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
System config value mysql.utf8mb4 set to boolean true
root@nextcloud:/var/www/nextcloud# sudo -u www-data php occ maintenance:repair
 - Repair MySQL collation
     - Change row format for oc_accounts ...
     - Change collation for oc_accounts ...
     - Change row format for oc_activity ...
     - Change collation for oc_activity ...
     - Change row format for oc_activity_mq ...
     - Change collation for oc_activity_mq ...
     - Change row format for oc_addressbookchanges ...
     - Change collation for oc_addressbookchanges ...
     - Change row format for oc_addressbooks ...
     - Change collation for oc_addressbooks ...

In AbstractMySQLDriver.php line 125:

  An exception occurred while executing 'ALTER TABLE `oc_addressbooks` CONVERT TO CHARACTER SET
   utf8mb4 COLLATE utf8mb4_bin;':

root@nextcloud:/var/www/nextcloud# sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"
Nextcloud is in maintenance mode - no apps have been loaded

System config value mysql.utf8mb4 set to boolean true
root@nextcloud:/var/www/nextcloud# sudo -u www-data php occ maintenance:repair
Nextcloud is in maintenance mode - no apps have been loaded

 - Repair MySQL collation
     - Change row format for oc_addressbooks ...
     - Change collation for oc_addressbooks ...

In AbstractMySQLDriver.php line 125:

  An exception occurred while executing 'ALTER TABLE `oc_addressbooks` CONVERT TO CHARACTER SET
   utf8mb4 COLLATE utf8mb4_bin;':

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key l
  ength is 767 bytes

In PDOStatement.php line 143:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key l
  ength is 767 bytes

In PDOStatement.php line 141:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key l
  ength is 767 bytes

```

---

<div class="post-metadata">

**Author:** ![XenonOrion](https://help.nextcloud.com/user_avatar/help.nextcloud.com/xenonorion/32/25002_2.png) [@XenonOrion](https://help.nextcloud.com/u/XenonOrion)\
**Post date:** [March 29, 2020, 10:49am UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/2 "2020-03-29T10:49:58Z")

</div>

Currently running into the same issue here, on tarball build on Centos7.  
Did this error have an impact on the server performance?

Did you go with `mb4` support, or did you disable it, just to be sure?

---

<div class="post-metadata">

**Author:** ![XenonOrion](https://help.nextcloud.com/user_avatar/help.nextcloud.com/xenonorion/32/25002_2.png) [@XenonOrion](https://help.nextcloud.com/u/XenonOrion)\
**Post date:** [April 1, 2020, 2:58pm UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/3 "2020-04-01T14:58:20Z")

</div>

> [@\[SOLVED\] Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes](https://help.nextcloud.com/t/solved-syntax-error-or-access-violation-1071-specified-key-was-too-long-max-key-length-is-767-bytes/34740/15):
>
> I don’t get this fixed, any idea what am I doing wrong? My NC is is 17.1, just upgraded from 17. Mariadb is mariadb103-server-10.3.13 (freebsd iocage) SHOW VARIABLES like 'innodb\_large\_prefix'; +---------------------+-------+ | Variable\_name | Value | +---------------------+-------+ | innodb\_large\_prefix | true | +---------------------+-------+ 1 row in set (0.001 sec) MariaDB [nextcloud]\> SHOW VARIABLES like 'innodb\_file\_format'; +--------------------+-----------+ | Variable\_name …

---

<div class="post-metadata">

**Author:** ![XenonOrion](https://help.nextcloud.com/user_avatar/help.nextcloud.com/xenonorion/32/25002_2.png) [@XenonOrion](https://help.nextcloud.com/u/XenonOrion)\
**Post date:** [April 1, 2020, 2:59pm UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/4 "2020-04-01T14:59:05Z")

</div>

This thread it a duplicate, and solved in the thread above.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 10:40am UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/5 "2024-12-04T10:40:59Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 3:49pm UTC](https://help.nextcloud.com/t/converting-to-utf8mb4/62536/6 "2024-12-11T15:49:45Z")

</div>


