0

我正在尝试为我的 OpenGTS 安装初始化数据库。但是,当我运行完成此操作的 shell 脚本时,我收到以下错误:

Version: 2.4.5
Database created: gts
[ERROR|DBAdmin.execCommands:843] ==> SQLException: DB grant error [jdbc:mysql://localhost:3306/]
[ERROR|DBAdmin.execCommands:843] Message:   The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
[ERROR|DBAdmin.execCommands:843] SQLState:  HY000
[ERROR|DBAdmin.execCommands:843] ErrorCode: 1290
[DBAdmin.execCommands:843] java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
        at org.opengts.dbtools.DBConnection._executeUpdate(DBConnection.java:961)
        at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:908)
        at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:889)
        at org.opengts.dbtools.DBProvider.grantDBUser(DBProvider.java:2132)
        at org.opengts.dbtools.DBAdmin.execCommands(DBAdmin.java:841)
        at org.opengts.db.DBConfig._main(DBConfig.java:1246)
        at org.opengts.db.DBConfig.main(DBConfig.java:1361)

我认为很明显我需要禁用--skip-grant-tables,但总的来说我对 MySQL 和 SQL 还是陌生的。最近,我按照教程重置了 MySQL 根密码,我相信我通过它启用了 --skip-grant-tables。我已经尝试寻找禁用此功能的解决方案,但没有遇到任何问题。

有谁能帮忙吗?

4

4 回答 4

3

只需键入:mysqladmin shutdown,然后通过运行命令启动 MySQL 服务:service mysql start

:-)

于 2016-01-06T17:15:09.113 回答
2

检查您的 my.cnf 文件,您可能在其中添加了该选项。

于 2012-11-21T16:25:57.823 回答
2

尝试这个:

sudo systemctl set-environment MYSQLD_OPTS=""

(它对我有用。)

于 2020-10-14T16:10:58.630 回答
1

你必须停止服务器并运行它

mysqld_safe --skip-grant-tables 由于 root pwd chg

所以停止服务器并正常启动它

于 2012-11-21T16:50:12.313 回答