Search code examples
sqlmysqlddlmysql-error-1064

Why sql-script isn't executed?


CREATE TABLE PERMISSIONS(
   ID BIGINT NOT NULL PRIMARY KEY,
   NAME VARCHAR(255) NOT NULL, UNIQUE(ID)
) 
CREATE TABLE ROLES(
   ID BIGINT NOT NULL PRIMARY KEY, 
   NAME VARCHAR(255)
)

I want to run this in MySql. When I try to execute separately each create-query everything works fine but they don't work together. I thought that separator was missed and tried to put semicolon after each query but MySql says that I have syntax mistake near ";" . Where is the mistake?


Solution

  • using the queries in the mysql console with a semi-colon after the each statement works. maybe you use an api (like php's mysql_query) which only supports one query at the time.