ERROR 2006 (HY000) at line 749: MySQL server has gone away (MariaDB/MySQL)

OS:CentOS Linux release 7.1.1503
DB: MariaDB 5.5.44

Importing a big mysql dump file resulted in the following error:

ERROR 2006 (HY000) at line 749: MySQL server has gone away

Line 749 was a very big INSERT query. To fix this, place the following into /etc/my.cnf.d/large.cnf

max_allowed_packet = 64M
wait_timeout = 6000

max_allowed_packet = 64M

Then restart mariadb/mysqld:

systemctl restart mariadb
ERROR 2006 (HY000) at line 749: MySQL server has gone away (MariaDB/MySQL)

ownCloud on Debian 8 (Jessie)

This how-to will cover setting up an instance of ownCloud on Debian 8 using MySQL as the database and the Apache webserver
Not covered in this how-to: opening ports in the firewall.

Set up the ownCloud Debian 8 repository:

echo 'deb /' >> /etc/apt/sources.list.d/owncloud.list
wget -O- | apt-key add -

Install ownCloud and its dependencies (apache2, mysql, php-* etc…):

apt-get update
apt-get -y install owncloud

Configure MySql:


(Optional) Move valid cert and key to /etc/ssl/
You can get free SSL Certificates here:

mv owncloud.crt.pem /etc/ssl/certs/
mv owncloud.key.pem /etc/ssl/private/
chown root:ssl-cert /etc/ssl/private/owncloud.key.pem
chmod 640 /etc/ssl/private/owncloud.key.pem
chown root:root /etc/ssl/certs/owncloud.crt.pem
chmod 644 /etc/ssl/certs/owncloud.crt.pem

Create a new site config with a VirtualHost:
Note: Replace the IP address and domain name with whatever domain and IP you are using.

echo '<IfModule mod_ssl.c>
		DocumentRoot /var/www/owncloud/
		ErrorLog ${APACHE_LOG_DIR}/owncloud.domain.com_error.log
		CustomLog ${APACHE_LOG_DIR}/owncloud.domain.com_access.log combined
		SSLEngine on
		SSLCertificateFile      /etc/ssl/certs/owncloud.crt.pem
		SSLCertificateKeyFile /etc/ssl/private/owncloud.key.pem
		<FilesMatch "\.(cgi|shtml|phtml|php)$">
			SSLOptions +StdEnvVars
		<Directory /usr/lib/cgi-bin>
			SSLOptions +StdEnvVars
		BrowserMatch "MSIE [2-6]" \
			nokeepalive ssl-unclean-shutdown \
			downgrade-1.0 force-response-1.0
		BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</IfModule>' > /etc/apache2/sites-available/

Enable the site, the ssl module and reload apache2:

a2enmod ssl
systemctl reload apache2.service

Note: I recommend setting up up strong SSL security on Apache.

Open ownCloud in a browser, and follow the initial setup instructions using MySQL as a database:
owncloud initial setup

ownCloud on Debian 8 (Jessie)