java.sql.SQLException: Unknown initial character set index '255' received from server for connector 8.0.11

sachin sarangamath :

While establishing the connection to a MySQL database, I'm getting the following error

java.sql.SQLException: Unknown initial character set index '255' received from 
server. Initial client character set can be forced via the 'characterEncoding' 
property.

Upon googling, I got to know that we need to modify 2 params in my.ini or my.cnf.

I am using MySQL version 8.0.11 and it does not have this file.

Hence I modified these parameters using the SQL commands:
Please note name and duration are column name in the table.

ALTER TABLE courses MODIFY name VARCHAR(50) COLLATE utf8_unicode_ci;    
ALTER TABLE courses MODIFY duration VARCHAR(50) COLLATE utf8_unicode_ci;

ALTER TABLE courses MODIFY name VARCHAR(50) CHARACTER SET utf8;
ALTER TABLE courses MODIFY duration VARCHAR(50) CHARACTER SET utf8;

Hence my table looks like this

Table

After this, I restarted MySQL server, but I'm still getting the above error.

Please note I'm deploying my application in tomcat and running rest API call which will connect to the database. While connecting to the database, I'm getting the above error.

Knautiluz :

Using MySQLWorkbench interface:

First click in your connection ->

enter image description here

After click in Options File

enter image description here

And change character-set-server and collation-server values to the values below:

enter image description here

Make sure to restart mysql server by opening services and restarting mysql server.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=464210&siteId=1