我可以運行我的grails應用程序,以對內置的內存數據庫運行,但是當我嘗試使用MYSQL時,它始終無法創建具有以下錯誤的模式。Grails:無法在mysql上創建表
2014-04-11 16:05:16,445 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Unsuccessful: create table registration_code (id bigint not null auto_increment, date_created datetime not null, token varchar(255) not null, username varchar(255) not null, primary key (id)) type=InnoDB
2014-04-11 16:05:16,448 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - 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 'type=InnoDB' at line 1
2014-04-11 16:05:16,449 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Unsuccessful: create table report (id bigint not null auto_increment, version bigint not null, category varchar(255) not null, description longtext not null, name varchar(255) not null unique, reportsql longtext not null, views integer not null, primary key (id)) type=InnoDB
這個錯誤告訴我,幾乎沒有。
它可能是它試圖創建一個mysql模式,因爲他建立在內存DB出於某種原因。
registration_code表大概是我安裝的spring安全模塊的一部分。 我可以手工創建「報告」表,它不包含保留字或類似內容。
在mysql中,我創建了一個與應用程序同名的數據庫(我猜我必須這樣做)。我正在使用的用戶擁有全局權限和創建的數據庫。
有沒有什麼辦法可以調試呢?例如任何方式來看看什麼SQL Grails試圖使用?
我試圖打電話給我所有的領域對象和領域未保留的東西(如secRoles而不是角色)
我DataSource.groovy的是這樣的:
dataSource {
dialect = org.hibernate.dialect.MySQLInnoDBDialect
pooled = true
jmxExport = true
driverClassName = "com.mysql.jdbc.Driver"
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
environments {
development {
dataSource {
dbCreate = "create"
username = "myuser"
password = "mypass"
url = 'jdbc:mysql://localhost/'
}
的MySQL 5.6 的Grails 2.3.6 Windows服務器。
似乎與此有關:「MySQL 5.5不支持」type「表選項,而是使用ENGINE選項。」看來,Grails 2.3.6開箱即不支持MSSQL服務器5.6。什麼? –
Grails爲什麼要支持MySQL,而不是Oracle,Postgres等。即使這是一個好主意(我認爲它不是),Grails如何知道MySQL運行在哪臺機器上,或者哪個用戶名和密碼登錄?一個內存中的數據庫是唯一合理的默認值 –
我並不是說默認情況下grails不應該使用內存數據庫。我的意思是它有一個註釋掉的例子或者類似的表示如何連接到mysql。我不得不在互聯網上找到一個例子,當然這個例子原來是舊的,並且不起作用。 –