连接 Mysql 失败

连接 Mysql 失败

我需要一些帮助来安装/连接应用程序到 mysql 数据库。第一次我遇到了很多问题/错误,其中大部分都消失了,结果就是什么都没有哈哈...有人知道正确的方法吗?下面您可以找到日志。

ws02@ws02:/usr/bin/wso2/wso2emm-2.0.1/bin$ sudo -E  ./wso2server.sh -Dsetup
JAVA_HOME environment variable is set to /usr/java/jdk1.8.0_91/
CARBON_HOME environment variable is set to /usr/bin/wso2/wso2emm-2.0.1
Using Java memory options: -Xms256m -Xmx1024m
[2016-05-08 03:18:17,379]  INFO {org.wso2.carbon.appmgt.impl.internal.AppDiscoveryComponent} -  WebApp Discovery component activated
[2016-05-08 03:18:17,424]  INFO {org.wso2.carbon.appmgt.mobile.internal.AppManagerMobileComponent} -  WSO2MDM_INTERNAL MDM is bound to App Manager
[2016-05-08 03:18:17,424]  INFO {org.wso2.carbon.appmgt.mobile.internal.AppManagerMobileComponent} -  App Manger Mobile Component activated
[2016-05-08 03:18:18,083]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Starting WSO2 Carbon...
[2016-05-08 03:18:18,084]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Operating System : Linux 4.4.0-21-generic, amd64
[2016-05-08 03:18:18,084]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Java Home        : /usr/java/jdk1.8.0_91/jre
[2016-05-08 03:18:18,085]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Java Version     : 1.8.0_91
[2016-05-08 03:18:18,085]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Java VM          : Java HotSpot(TM) 64-Bit Server VM 25.91-b14,Oracle Corporation
[2016-05-08 03:18:18,085]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Carbon Home      : /usr/bin/wso2/wso2emm-2.0.1
[2016-05-08 03:18:18,085]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  Java Temp Dir    : /usr/bin/wso2/wso2emm-2.0.1/tmp
[2016-05-08 03:18:18,086]  INFO {org.wso2.carbon.core.internal.CarbonCoreActivator} -  User             : root, nl-NL, Europe/Amsterdam
[2016-05-08 03:18:18,494]  WARN {org.wso2.carbon.core.bootup.validator.util.ValidationResultPrinter} -  Maximum PermGen space (MB) :0 of the running JVM is set below the recommended minimum size :256
[2016-05-08 03:18:18,495]  WARN {org.wso2.carbon.core.bootup.validator.util.ValidationResultPrinter} -  Carbon is configured to use the default keystore (wso2carbon.jks). To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profile.
Activating org.wso2.jaggery.scxml with RealmService enabled
[2016-05-08 03:18:24,330] ERROR {org.wso2.carbon.user.core.internal.Activator} -  Cannot start User Manager Core bundle
java.lang.Exception: Error in creating the database
    at org.wso2.carbon.user.core.common.DefaultRealmService.initializeDatabase(DefaultRealmService.java:338)
    at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:88)
    at org.wso2.carbon.user.core.common.DefaultRealmService.<init>(DefaultRealmService.java:112)
    at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:68)
    at org.wso2.carbon.user.core.internal.BundleCheckActivator.start(BundleCheckActivator.java:61)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.Exception: Error occurred while executing :   CREATE TABLE IF NOT EXISTS REG_RESOURCE ( REG_PATH_ID         INTEGER NOT NULL, REG_NAME            VARCHAR(256), REG_VERSION         INTEGER NOT NULL AUTO_INCREMENT, REG_MEDIA_TYPE      VARCHAR(500), REG_CREATOR         VARCHAR(31) NOT NULL, REG_CREATED_TIME    TIMESTAMP NOT NULL DEFAULT 0, REG_LAST_UPDATOR    VARCHAR(31), REG_LAST_UPDATED_TIME    TIMESTAMP NOT NULL DEFAULT 0, REG_DESCRIPTION     VARCHAR(1000), REG_CONTENT_ID      INTEGER, REG_TENANT_ID INTEGER DEFAULT 0, REG_UUID VARCHAR(100) NOT NULL, CONSTRAINT PK_REG_RESOURCE PRIMARY KEY(REG_VERSION, REG_TENANT_ID) )ENGINE INNODB
    at org.wso2.carbon.utils.dbcreator.DatabaseCreator.executeSQL(DatabaseCreator.java:169)
    at org.wso2.carbon.utils.dbcreator.DatabaseCreator.executeSQLScript(DatabaseCreator.java:325)
    at org.wso2.carbon.utils.dbcreator.DatabaseCreator.createRegistryDatabase(DatabaseCreator.java:61)
    at org.wso2.carbon.user.core.common.DefaultRealmService.initializeDatabase(DefaultRealmService.java:328)
    ... 19 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Invalid default value for 'REG_CREATED_TIME'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.Util.getInstance(Util.java:387)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505)
    at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
    at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
    at org.wso2.carbon.utils.dbcreator.DatabaseCreator.executeSQL(DatabaseCreator.java:139)
    ... 22 more
[2016-05-08 03:21:29,785]  INFO {org.apache.catalina.startup.TaglibUriRule} -  TLD skipped. URI: http://tiles.apache.org/tags-tiles is already defined

希望有人可以帮助我,因为我不是 Linux 专业人士。

答案1

正如您所附的,它来自日志:

原因:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:“REG_CREATED_TIME”的默认值无效

根据这个,Ubuntu 或 Linux 没有问题。这是一个 Java 问题,日志是 Java 堆栈跟踪。

更新:

好的,我做了一些调查,并尝试安装一个用 Java 编写的企业服务总线 ESB 服务器。当您运行脚本时,它会尝试使用一些默认值初始化数据库。但是它无法完成,因为这个错误(见上文)。

我认为 MySQL 的不同版本导致了此错误或 JDBC 连接器版本差异。

你应该遵循文件或与开发人员取得联系。

答案2

这是 MySql 5.7 的一个已知问题。这里提到了一种解决方法[1]

解决方法:

设置 GLOBAL sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";

[1]https://wso2.org/jira/browse/APIMANAGER-4645

相关内容