DROP TABLE IF EXISTS `migration_versions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migration_versions` (
`version` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8mb4_unicode_520_ci
/*!40101 SET character_set_client = @saved_cs_client */;
is giving me this error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET character_set_client = @saved_cs_client */' at line 5
This is the original (unedited) exported statement. The only thing I did was change collations to utf8mb4_unicode_520_ci
.
DROP TABLE IF EXISTS `migration_versions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `migration_versions` (
`version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
Any ideas anyone?
1 Answer 1
The Create Table statement needs to be terminated with a semi-colon (after your new Collation sequence).
The 40101
comments will be included or not based on your DBMS version.
In this case, they're clearly being included, so your script is effectively this:
DROP TABLE IF EXISTS `migration_versions`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `migration_versions` (
`version` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8mb4_unicode_520_ci
SET character_set_client = @saved_cs_client;
Without the statement terminator, it's trying to treat the Set statement as just another clause in the Create Table statement.
Server version: 10.3.23-MariaDB-cll-lve - MariaDB Server
, and server being imported into:Server version: 10.8.3-MariaDB-1:10.8.3+maria~jammy-log - mariadb.org binary distribution