Sort_buffer_size system variable can be configured using the command line or configuration file:
Command Line:
mysqld> set global sort_buffer_size = XX Replace
XX with a value to suit your database needs. This change will only be applied to new connections. Make a new connection to the server, and the values will update. SET GLOBAL will not persist through a server restart.
Configuration File:
[mysqld] sort_buffer_size = XX Replace
XX with value to suit your database needs. Must restart the server to see changes applied.
Before setting this value, it’s helpful to estimate how much memory your server can safely allocate. Use our
MySQL Memory Calculators to avoid overcommitting resources.