Memory allocation error 1038 during connection to mysql

This worked for me:

You probably need to increase the buffer size of mysql in the /etc/mysql/my.cnf, something like:

[mysqld]
sort_buffer_size=256k