Struts2+Spring+Hibernate连接mysql中文乱码解决
1.struts.xml中设置
<constant name="struts.il8n.encoding" value="UTF-8"></constant>
2.jsp页面设置
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
3.数据库连接url
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
或
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=gbk
相关文档:
#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field;
......
[root@sql21 ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.1.26-rc-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database &nb ......
数据库目录是MySQL数据库服务器存放数据文件的地方,不仅包括有关表的文件,还包括数据文件和MySQL的服务器选项文件。不同的分发,数据库目录的缺省位置是不同的。
数据目录的位置
缺省的数据库位置
缺省数据库的位置编译在服务器中。
◆如果您是在一个源程序分发包中安装 MySQL,典型的缺省位置可能是 /usr/local/var ......
首先需要卸载redhat自带的mysql数据库(不然安装时会出问题)
rpm -qa|grep mysql
然后 rpm -e 包名称
如果涉及到依赖,就先删除依赖,或者加个 -nodeps 参数忽略依赖
有网友说用yum -y remove mysql也可以
另一个解决方法时在linux自带mysql基础上再装新的mysql
二进制安装包版本很多,常用的就两个,我下的是 ......