The "MySQL server has gone away" message tends to be a result of timeouts in MySQL (or MariaDB). If you run the following command in the MySQL shell or in phpMyAdmin and reply with the results: SHOW GLOBAL VARIABLES WHERE variable_name IN ('wait_timeout', 'max_allowed_packet', 'net_read_timeout', 'net_write_timeout');
The values on my system are:
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 4194304 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| wait_timeout | 28800 |
+--------------------+---------+
There are posts on here suggesting increasing max_allowed_packet to 512 MB.
I should say that these timeouts would come into play if clicking on "send a message" is taking a long time. If it is there may be an error in the database table (possibly related to the corrupted database issue). Find out where your MySQL/MariaDB logs are (mine are in /var/log/mariadb/mariadb.log, yours may be somewhere else) and check these for errors. You may need to repair a table.