Solved – Mysql Out of sort memory, consider increasing server sort buffer size

In this tutorial we will go over the demonstration of Out of sort memory. step by step explain consider increasing server sort buffer size mysql. you’ll learn mysql 8 out of sort memory consider increasing server sort buffer size. i would like to show you out of sort memory consider increasing server sort buffer size ubuntu. Let’s get started with Out of sort memory.

few days ago i was working on laravel project and when i run one following sql query, it was working on local mysql. but not working on ubuntu server in digitalocean. it tried to run using mysql command and i was able to found exactly error:

Query:

select * from `posts` where exists (select * from `categories` inner join `post_category` on `categories`.`id` = `post_category`.`category_id` where `posts`.`id` = `post_category`.`post_id` and `categories`.`slug` = 'php') group by `posts`.`id` order by `posts`.`id` desc

Error Found:

i found following error:

ERROR 1038 (HY001): Out of sort memory, consider increasing server sort buffer size

Solution:

i search on google and find out solution with increasing size of “sort_buffer_size”. so let’s open my.cnf file update as like bellow:

sudo nano /etc/mysql/my.cnf

update as following:

/etc/mysql/my.cnf

[mysqld]

sort_buffer_size=5M

now you can restart mysql with following command:

sudo service mysql restart

I hope it can help you…

Leave a Comment