diff --git a/include/myisam.h b/include/myisam.h
index 5334fd6afc49bb054b4a3719fa54965943a9ce71..e502daa2f17965c9ff19d66f2158a07f0c720ffe 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -55,8 +55,6 @@ extern "C" {
 #define MI_MAX_MSG_BUF      1024 /* used in CHECK TABLE, REPAIR TABLE */
 #define MI_NAME_IEXT	".MYI"
 #define MI_NAME_DEXT	".MYD"
-/* Max extra space to use when sorting keys */
-#define MI_MAX_TEMP_LENGTH	2*1024L*1024L*1024L
 
 /* Possible values for myisam_block_size (must be power of 2) */
 #define MI_KEY_BLOCK_LENGTH	1024	/* default key block length */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index daa1bbe8cccc2bb0da28d5a15cda8e58bd74ea43..adf9ff19326be5b61e13bd39caef12a0df65ace8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6928,7 +6928,7 @@ thread is in the relay logs.",
    "It will be removed in MySQL " VER_CELOSIA,
    &global_system_variables.myisam_max_extra_sort_file_size,
    &max_system_variables.myisam_max_extra_sort_file_size,
-   0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,
+   0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32,
    0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
   {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
    "Don't use the fast sort index method to created index if the temporary "