The full error message typically looks like this:

The error was: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs

You usually have two options to fix this.

For the table in question run a query like this and make sure to replace log_visit with the name of the table that is causing this issue:

ALTER TABLE matomo_log_visit ROW_FORMAT=DYNAMIC;

Option 2 – changing the type of some existing custom dimensions or custom variables

if you use many custom dimensions

If you are using many custom dimensions, then converting some of them to TEXT might help. You can convert as many columns as needed. This can also be useful if you are trying to add more custom dimensions but you cannot add more slots because you ran into this limit.

ALTER TABLE matomo_log_visit MODIFY COLUMN custom_dimension_1 TEXT, MODIFY COLUMN custom_dimension_2 TEXT, MODIFY COLUMN custom_dimension_3 TEXT, MODIFY COLUMN custom_dimension_4 TEXT, MODIFY COLUMN custom_dimension_5 TEXT;

If you use more than 5 custom dimensions, you can add more statements in the query for example: , MODIFY COLUMN custom_dimension_6 TEXT.

if you use many custom variables

If you have many custom variables instead you can convert them to TEXT as well so they no longer count to the MySQL row size:

ALTER TABLE matomo_log_visit MODIFY COLUMN custom_var_k1 TEXT, MODIFY COLUMN custom_var_v1 TEXT, MODIFY COLUMN custom_var_k2 TEXT, MODIFY COLUMN custom_var_v2 TEXT;

Depending on your configured database table prefix you might need to replace matomo_log_visit with piwik_log_visit or log_visit for example in the SQL queries above.

Previous FAQ: What should I do when I get the error message: SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (11)