eclipse连接MySQL

1.eclipse 连 mysql数据库出现错误:nknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.

解决方法:String url = "jdbc:mysql://localhost:3306/jdbcStudy?useUnicode=true&characterEncoding=utf8";

2.访问报错com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client

解决方法:

执行语句修改

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '66666';

Query OK, 0 rows affected (0.11 sec)
mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.01 sec)

注意:root是用户名,localhost是特指本机,mysql_native_password是旧的密码验证机制,66666是密码

猜你喜欢

转载自www.cnblogs.com/lwpblogs/p/9164042.html