I am using mysql 8.0.x and trying to use liquibase version 3.6.2 to apply change log.
When I try to update changelog via command line, it works fine with yaml format but sql format does not work for changeset.
Here is whole setup. command-to-run.bat file is the exact command I am trying to fire.
I think the problem is same as this, but the that solution is not working too. Their problem is the fomatting of file should be not be UTF-8 BOM format, though that issue is fixed but I tried to change the format and I am still having issue.
I am using the same sql file liquibase has given example with. The error I am getting is following
Unexpected error running Liquibase: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
--changeset bob:1
create table item (
id int not nu' at line 1 [Failed SQL: --liquibase formatted sql
--changeset bob:1
create table item (
id int not null primary key,
name varchar(255) not null,
description varchar(255)
)]
liquibase.exception.MigrationFailedException: Migration failed for change set changelog-master.xml::third::akshay:
Reason: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
--changeset bob:1
create table item (
id int not nu' at line 1 [Failed SQL: --liquibase formatted sql
--changeset bob:1
create table item (
id int not null primary key,
name varchar(255) not null,
description varchar(255)
)]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:53)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:78)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.commandline.Main.doMigration(Main.java:1205)
at liquibase.integration.commandline.Main.run(Main.java:191)
at liquibase.integration.commandline.Main.main(Main.java:129)
Caused by: liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
--changeset bob:1
create table item (
id int not nu' at line 1 [Failed SQL: --liquibase formatted sql
--changeset bob:1
create table item (
id int not null primary key,
name varchar(255) not null,
description varchar(255)
)]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:356)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1229)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1211)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:600)
... 7 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '--liquibase formatted sql
--changeset bob:1
create table item (
id int not nu' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
... 12 common frames omitted
For more information, please use the --logLevel flag
Related
Im trying to run the following from the mysql shell client:
MySQL localhost:33060+ ssl plaything SQL > CREATE TABLE areas (id SERIAL PRIMARY KEY, area_name VARCHAR);
and keep getting the following error:
ERROR: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
where could I be going wrong?
solved by yoss:
try this: CREATE TABLE areas ( id int NOT NULL AUTO_INCREMENT, area_name varchar(255), PRIMARY KEY (id) );
varchar did not have number of characters specified in the original statement
I am creating an openfire database in mysql but whenvever i try to create it, it shows 'The Openfire database schema does not appear to be installed. Follow the installation guide to fix this error.'.
Log
2018.12.01 14:40:48 org.jivesoftware.database.SchemaManager - SchemaManager: Failed to execute SQL:
CREATE TABLE ofRosterGroups ( rosterID BIGINT NOT NULL, rank TINYINT NOT NULL, groupName VARCHAR(255) NULL, PRIMARY KEY (rosterID, rank), INDEX ofRosterGroup_rosterid_idx (rosterID) );
2018.12.01 14:40:48 org.jivesoftware.database.SchemaManager - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank TINYINT NOT NULL, groupName VARCHAR(' at line 1
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rank TINYINT NOT NULL, groupName VARCHAR(' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:781)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
This error comes up everytime while creating the openfire db tables
Any help will be appreciated
Thanks in advance
'rank' is, as of MySQL 8.0.2, a reserved keyword, which causes this query to fail. A fix for this issue has been provided in version 4.3.0 of Openfire.
I am attempting to run a sql file on a mysql at this address
https://github.com/articDrag0n/PrepApp/blob/master/sql/create_tables.sql
and I am getting an error
ERROR 1064 (42000) at line 20: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(ID)
)' at line 11
How do I fix this
It is not your version. There is an error in the script. The create offerings should read (comma was missing after icon VARCHAR(255)):
DROP TABLE IF EXISTS offerings;
CREATE TABLE offerings(
id int NOT NULL AUTO_INCREMENT,
name VARCHAR(255),
moderator TEXT,
moderator_email TEXT,
description TEXT,
location TEXT,
peopleLimit INT,
days TEXT,
icon VARCHAR(255),
PRIMARY KEY (ID)
);
write a sql sentence to create a table in MySQL
CREATE TABLE fb_web_user_feeds(id bigint not null primary key auto_increment,host_id bigint,,author varchar(64),time varchar(64),user_feed text)
BUT IT ERRORS:
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'author varchar(64),time varchar(64),user_feed text)' at line 1")
could you please tell me the reason
It's because you have 2 commas here:
host_id bigint,,author varchar(64)
It should just be 1 comma making your syntax be:
CREATE TABLE fb_web_user_feeds(id bigint not null primary key auto_increment,host_id bigint,author varchar(64),time varchar(64),user_feed text)
IF COL_LENGTH('Characters', 'name') IS NULL
BEGIN
ALTER TABLE `Characters` ADD `name` INT(32) UNSIGNED NOT NULL;
END
I am trying to write some sql that will insert a column name into the table "Characters" if it is not already existant, however I am getting errors which I do not understand (quite new to SQL) and I could use some help understanding why it is not working. I have gotten the IF part from another Question, and the ALTER part from the DBMS I'm using, PhpMyAdmin 2.11.4.
It is using MySQL 5.6 apparently and this is the error:
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF COL_LENGTH('Characters', 'name') IS NULL
BEGIN
ALTER TABLE `Characters` AD' at line 1