赞
踩
前提:nacos2.0.3,MySQL:8.0+,jdk:1.8
首先配置好cluster.conf、application.properties等文件之后启动,如果抛出下面的异常
2023-02-19 13:32:49,593 ERROR HikariPool-1 - Exception during pool initialization.
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at
或者是提醒:No DataSource Set的;
如果使用的MySQL是8.0以上版本的的时候,修改root的权限就可以:
步骤一:右键nacos数据库,打开命令行界面
步骤二:切换数据库到mysql,然后查询host和user
- use mysql;
-
- select host,user from user;
步骤三:修改root的权限,因为现在是只允许localhost访问。
update user set host='%' where user='root';
步骤四:刷新权限
flush privileges;
最后重启nacos即可
参考:https://blog.csdn.net/single_0910/article/details/120531076
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。