如何在MySQL中禁用--跳过授权表?

如何在MySQL中禁用--跳过授权表?,mysql,sql,jdbc,Mysql,Sql,Jdbc,我正在尝试为我的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 serv

我正在尝试为我的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)
我认为很明显,我需要禁用——跳过授权表,但我对MySQL和SQL一般都是新手。最近,我按照一个教程重置了MySQL根密码,我相信我已经启用了——跳过了授权表。我试图寻找解决方案来禁用此功能,但没有遇到任何问题


有人能提供帮助吗?

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

您必须已停止服务器并运行此选项

mysqld\u安全--由于根pwd chg,跳过授权表


因此,停止服务器并正常启动它,只需键入:
mysqladmin shutdown
,然后通过运行命令启动MySQL服务:
service MySQL start

:-)

试试这个:

sudo systemctl set-environment MYSQLD_OPTS=""

(它对我有效。)

我检查了,但没有,我没有在那里添加该选项。我之前遵循了本教程:在遵循本教程之后是否重新启动了Mysql。如果没有,你需要。。。当你重新启动时,你应该准备好了。解决了这个问题。我以为我重新启动了我的服务器,但我没有,因为我使用了
mysql stop
,并且得到了一个错误:
stop:Unknown Instance:
,所以它没有真正关闭。我使用了
mysqladmin关机
,它成功了。杰德的评论为我带来了魔力。服务器并没有真正停止。是的,这就是发生在我身上的:)