我正在尝试为我的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 root密码,我相信我启用了--skip-grant-tables。我试过寻找解决方案来禁用它,但是没有发现任何问题。
任何人都可以提供帮助吗?
答案 0 :(得分:4)
只需键入:mysqladmin shutdown
,然后运行命令service mysql start
启动MySQL服务。
: - )
答案 1 :(得分:2)
检查你的my.cnf文件,你可能在那里添加了该选项。
答案 2 :(得分:2)
您必须已停止服务器并运行此
mysqld_safe --skip-grant-tables
由于root pwd chg
所以停止服务器并以启动
启动它答案 3 :(得分:0)
尝试一下:
sudo systemctl set-environment MYSQLD_OPTS=""
(它对我有用。)