时间:2021-07-01 10:21:17 帮助过:17人阅读
乱码问题
tomcat造成的乱码,在server.xml中设置:
<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI="true" />
连接数据库的URL中加入编码格式,如:
jdbc.url= jdbc:mysql://127.0.0.1:3306/electronic-business?useUnicode=true&characterEncoding=UTF-8
数据库设置:
mysql> SET character_set_client=‘gbk‘;
mysql> SET character_set_connection=‘gbk‘
mysql> SET character_set_results=‘gbk‘
mysql> SET character_set_database=‘gbk‘;
mysql> SET character_set_server=‘gbk‘
mysql> SET character_set_results=‘gbk‘
改成gbk或者utf-8都可以
常用相关命令:查看数据库编码格式show variables like ‘character_set_%‘;查看数据库中的表的创建show create table tablename;设置数据库编码格式set names= ‘gbk‘;或者在mysql命令行下输入 \s查看mysql的字符集的方式
blob格式引起的乱码:blob读出来的是ISO-8859-1编码,你需要转换为GBK编码才可以Java codeString blob =...blob = new String(blob.getBytes("iso-885901"),"GBK");或者存取大文本的时候用mediumtext而不用blob
CentOS 7 通过yum安装MySQL 5.71.下载YUM库shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm2.安装YUM库shell > yum localinstall -y mysql57-community-release-el7-7.noarch.rpm3.安装数据库shell > yum install -y mysql-community-server4.启动MySQL服务shell > systemctl start mysqld.service
常见问题--MySQL
标签:com jdbc ctr ice sum 常用 微软 ack padding