发布网友 发布时间:2022-04-23 01:56
共3个回答
热心网友 时间:2022-04-08 12:58
字符集编码
安装mysql时,由于失误导致mysql默认编码为latin1,这样导致中文支持不了,遂想修改mysql编码为utf8。步骤如下:一、管理工具-->服务-->停掉mysql服务二、修改my.ini配置文件:1.在[client]的port=3306的下面一行添加default-character-set=utf8
2.将[mysql]中的default-character-set=latin1中的latin1改为utf8
3. 将[mysqld]中的default-character-set=latin1中的latin1改为utf8
三、重启mysql服务
service mysqld restart
四、进入mysql命令行,输入以下命令检查
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> show variables like 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
热心网友 时间:2022-04-08 14:16
用JDBC还是SSH?首先要确认数据库编码正确,建库的时候选UTF-8JDBC用 url请求改变字符编码,同上。ssh要加要加一个spring的过滤器
热心网友 时间:2022-04-08 15:51
请问你是命令行操作吗