diff --git a/VC++Files/libmysqld/libmysqld.dsp b/VC++Files/libmysqld/libmysqld.dsp
index 87a88333a2a521db3c6d9cd8557c3d1346b063a8..8c1a5271656a2fda16e3d23fe73ffc6b60b96128 100644
--- a/VC++Files/libmysqld/libmysqld.dsp
+++ b/VC++Files/libmysqld/libmysqld.dsp
@@ -363,6 +363,10 @@ SOURCE=..\mysys\my_getopt.c
 SOURCE=..\sql-common\my_time.c
 # End Source File
 # Begin Source File
+ 
+SOURCE=..\sql-common\my_user.c
+# End Source File
+# Begin Source File
 
 SOURCE=..\sql\net_serv.cpp
 # End Source File
diff --git a/VC++Files/libmysqld/libmysqld.vcproj b/VC++Files/libmysqld/libmysqld.vcproj
index 47fb660bb7a712e54e935ef3ebebb3b8709e9a45..fe791d702a3f39bf4836e25dc5ef639de94a24d0 100644
--- a/VC++Files/libmysqld/libmysqld.vcproj
+++ b/VC++Files/libmysqld/libmysqld.vcproj
@@ -2009,6 +2009,42 @@
 					PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/>
 			</FileConfiguration>
 		</File>
+		<File
+			RelativePath="..\sql-common\my_user.c">
+			<FileConfiguration
+				Name="Debug|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="0"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;SAFEMALLOC;HAVE_BERKELEY_DB;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;USE_TLS;__WIN__;$(NoInherit)"
+					BasicRuntimeChecks="3"/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="pro|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions="WIN32;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;EMBEDDED_LIBRARY;USE_TLS;__WIN__;MYSQL_SERVER;LICENSE=Commercial;_MBCS;HAVE_DLOPEN;HAVE_INNOBASE_DB;DBUG_OFF;NDEBUG;_WINDOWS;_CONSOLE;$(NoInherit)"/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;HAVE_INNOBASE_DB;DBUG_OFF;USE_TLS;__WIN__;$(NoInherit)"/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="classic|Win32">
+				<Tool
+					Name="VCCLCompilerTool"
+					Optimization="2"
+					AdditionalIncludeDirectories=""
+					PreprocessorDefinitions="WIN32;_WINDOWS;USE_SYMDIR;SIGNAL_WITH_VIO_CLOSE;HAVE_DLOPEN;EMBEDDED_LIBRARY;USE_TLS;__WIN__;LICENSE=Commercial;DBUG_OFF;_MBCS;NDEBUG;$(NoInherit)"/>
+			</FileConfiguration>
+		</File>
 		<File
 			RelativePath="..\sql\net_serv.cpp">
 			<FileConfiguration
diff --git a/VC++Files/libmysqld/libmysqld_ia64.dsp b/VC++Files/libmysqld/libmysqld_ia64.dsp
index b5223e38f2d2d618d8102a59b2c9d03222987918..9668193fc1def8bb582dc8f18b45b80c4f7174c5 100644
--- a/VC++Files/libmysqld/libmysqld_ia64.dsp
+++ b/VC++Files/libmysqld/libmysqld_ia64.dsp
@@ -338,6 +338,10 @@ SOURCE="..\sql-common\my_time.c"
 # End Source File
 # Begin Source File
 
+SOURCE="..\sql-common\my_user.c"
+# End Source File
+# Begin Source File
+
 SOURCE=..\sql\net_serv.cpp
 # End Source File
 # Begin Source File
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 3a5fa2e7287aaf72b1a74d6b15cc22c63e9177ff..25c1f6c1ddcde7c3555fc944641d96f6c777905b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -744,6 +744,7 @@ sub command_line_setup () {
     $glob_use_embedded_server= 1;
     push(@glob_test_mode, "embedded");
     $opt_skip_rpl= 1;              # We never run replication with embedded
+    $opt_skip_ndbcluster= 1;
 
     if ( $opt_extern )
     {
diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result
index 65c6955a959719d069985dde7ec58aefe9479c3e..fc267cb598d5c8d9f2ebb5393432a0b187391096 100644
--- a/mysql-test/r/analyze.result
+++ b/mysql-test/r/analyze.result
@@ -46,4 +46,12 @@ Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_
 execute stmt1;
 Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
 deallocate prepare stmt1;
+create temporary table t1(a int, index(a));
+insert into t1 values('1'),('2'),('3'),('4'),('5');
+analyze table t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+show index from t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
+t1	1	a	1	a	A	5	NULL	NULL	YES	BTREE	
 drop table t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index d32cd405ce8135edf682492a5e98303547f15d8e..77046cc1fd1058adebd17ba15c5e3268fcb242a5 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -3278,3 +3278,5 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
 a
 1
 drop table t2, t1;
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
+ERROR HY000: The used table type doesn't support SPATIAL indexes
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index e39ddd1d79d1f1a0fafe731c3338042b7738d3b4..c8cafe5ace148c53194980519771ca2c81b5f110 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -1,3 +1,4 @@
+drop table if exists t1,t3;
 drop procedure if exists bug4902|
 create procedure bug4902()
 begin
diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test
index a8fd0a4283e6ca7e7c796310e3d017b0d53660e6..1801a4a440fb81d08630c84b9fa3ef440588f0a8 100644
--- a/mysql-test/t/analyze.test
+++ b/mysql-test/t/analyze.test
@@ -61,6 +61,14 @@ prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
 execute stmt1;
 execute stmt1;
 deallocate prepare stmt1;
+
+#
+# bug#15225 (ANALYZE temporary has no effect)
+#
+create temporary table t1(a int, index(a));
+insert into t1 values('1'),('2'),('3'),('4'),('5');
+analyze table t1;
+show index from t1;
 drop table t1;
 
 # End of 4.1 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 3ba5ca5b4a24d0be79c5b8f78656352dc86c88ce..e4c8bf89ccaab8d63f17bb23c1e58e9759bf7478 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -2190,3 +2190,9 @@ SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
 SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
 
 drop table t2, t1;
+
+#
+# Bug #15680 (SPATIAL key in innodb)
+#
+--error ER_TABLE_CANT_HANDLE_SPKEYS
+create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 4eb429156b2a29959d649946bcd50fa6af59c3af..0adbeb2d98b43728de1b4402981f4453909e31e1 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -1,6 +1,10 @@
 # Can't test with embedded server
 -- source include/not_embedded.inc
 
+--sleep 2
+--disable_warnings
+drop table if exists t1,t3;
+--enable_warnings
 delimiter |;
 
 #
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index ff6431fa0f35c6f1aa1556d76824eab9a0b33a0a..128cc191434fd4664fb033eab2829175180ce75a 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -165,7 +165,7 @@ ha_myisam::ha_myisam(TABLE *table_arg)
   int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
                   HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
                   HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME |
-                  HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD),
+                  HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS),
   can_enable_indexes(1)
 {}
 
diff --git a/sql/handler.h b/sql/handler.h
index e531a3f1077edd8560d4985ca78d679c94832d0b..eee15fc35762ebbc799cfb00c541a15f98f75922 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -80,6 +80,7 @@
 */
 #define HA_CAN_INSERT_DELAYED  (1 << 14)
 #define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
+#define HA_CAN_RTREEKEYS       (1 << 17)
 #define HA_NOT_DELETE_WITH_CACHE (1 << 18)
 #define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
 #define HA_CAN_FULLTEXT        (1 << 21)
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 7665a7425cd7bfdadac6f109a7f8d76f191910cb..2892c5c8b013977ac88b17e7fb0309a673327bb4 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5617,3 +5617,5 @@ ER_VIEW_RECURSIVE
         eng "`%-.64s`.`%-.64s` contains view recursion"
 ER_NON_GROUPING_FIELD_USED 42000
 	eng "non-grouping field '%-.64s' is used in %-.64s clause"
+ER_TABLE_CANT_HANDLE_SPKEYS
+        eng "The used table type doesn't support SPATIAL indexes"
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7b739798b387dee1c186e3b55d6cf2460a30f05a..c9e9ce1bba7a02d35d229a03c4e2781578be2f1b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1159,6 +1159,12 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
     /* TODO: Add proper checks if handler supports key_type and algorithm */
     if (key_info->flags & HA_SPATIAL)
     {
+      if (!(file->table_flags() & HA_CAN_RTREEKEYS))
+      {
+        my_message(ER_TABLE_CANT_HANDLE_SPKEYS, ER(ER_TABLE_CANT_HANDLE_SPKEYS),
+                   MYF(0));
+        DBUG_RETURN(-1);
+      }
       if (key_info->key_parts != 1)
       {
 	my_error(ER_WRONG_ARGUMENTS, MYF(0), "SPATIAL INDEX");
@@ -2566,11 +2572,16 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
         table->table->s->version=0;               // Force close of table
       else if (open_for_modify)
       {
-        pthread_mutex_lock(&LOCK_open);
-        remove_table_from_cache(thd, table->table->s->db,
-                                table->table->s->table_name, RTFC_NO_FLAG);
-        pthread_mutex_unlock(&LOCK_open);
-        /* Something may be modified, that's why we have to invalidate cache */
+        if (table->table->s->tmp_table)
+          table->table->file->info(HA_STATUS_CONST);
+        else
+        {
+          pthread_mutex_lock(&LOCK_open);
+          remove_table_from_cache(thd, table->table->s->db,
+                                  table->table->s->table_name, RTFC_NO_FLAG);
+          pthread_mutex_unlock(&LOCK_open);
+        }
+        /* May be something modified consequently we have to invalidate cache */
         query_cache_invalidate3(thd, table->table, 0);
       }
     }