diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result
index bcfbe3355f9..79ecc67666c 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm.result
+++ b/mysql-test/suite/innodb/r/alter_algorithm.result
@@ -41,6 +41,9 @@ info: Records: 1  Duplicates: 0  Warnings: 0
 ALTER TABLE t1 ENGINE=INNODB;
 affected rows: 1
 info: Records: 1  Duplicates: 0  Warnings: 0
+ALTER TABLE t1 ENGINE=INNODB,ALGORITHM=DEFAULT;
+affected rows: 1
+info: Records: 1  Duplicates: 0  Warnings: 0
 DROP TABLE t1;
 affected rows: 0
 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test
index d410a15154d..e69f6578471 100644
--- a/mysql-test/suite/innodb/t/alter_algorithm.test
+++ b/mysql-test/suite/innodb/t/alter_algorithm.test
@@ -55,6 +55,10 @@ ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
 --error $error_code
 ALTER TABLE t1 ENGINE=INNODB;
 
+# Irrespective of alter_algorithm value, the following command
+# should succeed because of explicitly mentioning ALGORTHM=DEFAULT
+ALTER TABLE t1 ENGINE=INNODB,ALGORITHM=DEFAULT;
+
 DROP TABLE t1;
 --disable_info
 
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index b3a036eda9e..a184899120c 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -93,6 +93,9 @@ const char* Alter_info::algorithm() const
     return "ALGORITHM=INPLACE";
   case ALTER_TABLE_ALGORITHM_COPY:
     return "ALGORITHM=COPY";
+  case ALTER_TABLE_ALGORITHM_NONE:
+    DBUG_ASSERT(0);
+    /* Fall through */
   case ALTER_TABLE_ALGORITHM_DEFAULT:
     return "ALGORITHM=DEFAULT";
   case ALTER_TABLE_ALGORITHM_NOCOPY:
@@ -123,7 +126,9 @@ const char* Alter_info::lock() const
 bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
                                     const Alter_inplace_info *ha_alter_info)
 {
-  if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
+
+  /* Use alter_algorithm when user didn't specify algorithm in alter */
+  if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_NONE)
     requested_algorithm = (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm;
 
   switch (result) {
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index 10aafe1ab37..5f2dd451125 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -57,7 +57,10 @@ class Alter_info
     ALTER_TABLE_ALGORITHM_NOCOPY,
 
     // Instant should allow any operation that changes metadata only.
-    ALTER_TABLE_ALGORITHM_INSTANT
+    ALTER_TABLE_ALGORITHM_INSTANT,
+
+    // When there is no specification of algorithm during alter table.
+    ALTER_TABLE_ALGORITHM_NONE
   };
 
 
@@ -114,7 +117,7 @@ class Alter_info
   flags(0), partition_flags(0),
     keys_onoff(LEAVE_AS_IS),
     num_parts(0),
-    requested_algorithm(ALTER_TABLE_ALGORITHM_DEFAULT),
+    requested_algorithm(ALTER_TABLE_ALGORITHM_NONE),
     requested_lock(ALTER_TABLE_LOCK_DEFAULT)
   {}
 
@@ -130,7 +133,7 @@ class Alter_info
     keys_onoff= LEAVE_AS_IS;
     num_parts= 0;
     partition_names.empty();
-    requested_algorithm= ALTER_TABLE_ALGORITHM_DEFAULT;
+    requested_algorithm= ALTER_TABLE_ALGORITHM_NONE;
     requested_lock= ALTER_TABLE_LOCK_DEFAULT;
   }
 
