0

I have downloaded a database image (The ANSI compatible version) of a MySQL database from this site. I tried running the sql statements on MySQL Workbench 5.7:

USE ergast_f1;

/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE "circuits" (
  "circuitId" int(11) NOT NULL AUTO_INCREMENT,
  "circuitRef" varchar(255) NOT NULL DEFAULT '',
  "name" varchar(255) NOT NULL DEFAULT '',
  "location" varchar(255) DEFAULT NULL,
  "country" varchar(255) DEFAULT NULL,
  "lat" float DEFAULT NULL,
  "lng" float DEFAULT NULL,
  "alt" int(11) DEFAULT NULL,
  "url" varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY ("circuitId"),
  UNIQUE KEY "url" ("url")
);

I am unable to run the above statements as long as there is usage of double quotation-marks(I have already successfully created the ergast_f1 database). Is there any way I can run the above statements without removing the double-quotation marks?, As there are more than hundreds of thousands of statements beyond the one above.

Thank you.

S23
  • 119
  • 12
  • Run this query `SELECT @@GLOBAL.sql_mode, @@SESSION.sql_mode` and post the result. – Salman A Jul 26 '21 at 12:31
  • @SalmanA Thank you for responding, but once I copy and paste the above statement, the workbench closes for some reason. – S23 Jul 26 '21 at 12:39
  • Any other way to find out the sql mode (e.g. does workbench show you server variables somewhere)? Anyway, in order for above query to work as expected the mode needs to contain `ANSI_QUOTES`. See if [this exact answer](https://stackoverflow.com/a/65400085/87015) helps – Salman A Jul 26 '21 at 12:42
  • I ran the commands in the mysql cmd line and these were the responses: **@@GLOBAL.sql_mode:** STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION , **@@SESSION.sql_mode:** STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION – S23 Jul 26 '21 at 13:01
  • Run the command `SET SESSION sql_mode= 'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ANSI_QUOTES'` (append the additional mode to existing ones) then import the file in same _session_. I would rather configure MySQL to use ANSI mode using my.cnf file so that it always runs in ANSI mode. – Salman A Jul 26 '21 at 13:20

0 Answers0