¹ØÓÚmysql¶ÁÈ¡¡¢Ð´Èë³öÏÖÂÒÂëµÄ½â¾ö·½·¨£¨¸öÈË×ܽᣩ
ÎÒʹÓõÄÊÇapserv°²×°°ü£¬°²×°Ê±ÓïÑÔÎÒÑ¡ÔñµÄÊÇgb2312£¬ºóÀ´ÔÚ½¨Á¢ÐµÄÊý¾Ý¿âʱ£¬‘ÕûÀí’Ñ¡ÔñµÄÊÇutf8£¬½ÓÏÂÀ´ÔÚ±íÖвÎÊýÀàÐÍ»ù±¾Ñ¡ÔñµÄ¶¼ÊÇutf8£¬½ÓÏÂÀ´ÎÒ¾ÍÖ±½Óµ÷ÓÃÀ²£¬¸Â¸Â£¬ÎÒдµÄÊÇÒ»¸ö¼òµ¥µÄÁôÑÔ±¾¡£×î¼òµ¥µÄ¶ÁÈ¡Êý¾Ý¿âдÈëÊý¾Ý¿âµÄ³ÌÐò£¬¸Â¸Â£¡Ææ¹ÖµÄÊÇÔÚÊý¾Ý¿âÀïÃæÖ±½Ó²Ù×÷ÖÐÎÄÏÔʾ¶¼ºÜÕý³£¡£¿ÉÊÇÒ»µ½ÍøÒ³É϶ÁÈ¡ÁôÑÔÐÅϢʱ£¬ÖÐÎÄÈ«²¿ÊÇÎʺţ¿£¬È»ºóÎÒÓÖÊÔ×Åд³öдÁôÑÔ´úÂëÊÔÊÔ¿´£¬orz£¬¶Á½øÈ¥µÄ¶¼ÊÇÄǸö²»ÖªµÀʲô·ûºÅ¡£¡£¡£
ÓÚÊǺõÎÒ¾ÍÈ¥ÍøÉÏ·Ì츲µØµÄÕÒÁ˺þã¬ÖÕÓÚKOÁËÕâ¸öÎÊÌ⣬¸Â¸Â¡£
Ê×ÏÈÉùÃ÷±¾È˳õѧ£¬Ö»Äܱ£Ö¤ÎÒÕâÖÖ·½·¨ÊÇÄܹ»½â¾ö¶ÁȡдÈëÂÒÂëµÄ¡£µ«ÊDz»´ú±íÖ»ÄÜÕâÑù×ö¡£¡£¡£
ÎҵĽâ¾ö·½·¨ÈçÏ£º
1.my.iniÎļþÖеÄ
[mysql]
default-character-set = utf8 //´Ë´¦ÉèÖÃΪutf8,×¢Òâ²»ÊÇutf-8
2.ÔÚÁ¬½ÓÊý¾Ý¿âÑ¡Ôñ±íÖ®ºó£¬²Ù×÷Êý¾ÝÇ°£¬Ìí¼ÓÒ»¾ä mysql_query("SET NAMES 'GB2312'");
¸Â¸Â£¬1²»È·¶¨ÊDz»ÊDZØÒªµÄ£¬µ«ÊÇÎÒÈ·¶¨2ÊDZØÒªµÄ£¬ÆäËûµÄ¾ÍÊÇÔÚ±íÖÐÊý¾Ý¾¡Á¿²ÉÓÃutf8.
ÕâÑùÎÊÌâ¾Í½â¾öÀ²£¡
ºÃ£¬Õ¹Ê¾Ï¸öÈËдµÄµÚÒ»¸ö³¬³¬³¬³¬¼òµ¥µÄÁôÑÔ±¾³ÌÐò£¬¸Õѧphp£¬Ã»×ö¸ñʽ¿ØÖÆ£¬´ó¼Ò±ðЦ»°¡£ÕâÊÇ´¿ÊÖдŶ£¡
/*Ê×Ò³¶ÁÈ¡ÁôÑÔÐÅÏ¢µÄ´úÂëindex.php*/
<?php include("include/config.php");?>
<?PHP include("include/head.php");?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÁôÑÔ±¾</title>
</head>
<body>
<p>
<?php include("include/conn.php");
$q = "SELECT * from lyb";
mysql_query("SET NAMES 'GB2312'"); // ·ÀÖ¹³öÏÖÂÒÂë
?>
<?
$rs = mysql_query($q, $dbh);
/*Êä³öÊý¾Ý²¢·ÖÐÐ*/
while($row = mysql_fetch_array($rs)) echo "ÐòºÅ$row[id] ÐÕÃû:$row[name] qq:$row[qq] ÄÚÈÝ:$row[content]<br/>";
?>
<?php include("include/foot.php")?>
</p>
<p><a href="input2.php">дÁôÑÔ</a></p>
/*input2.phpÖÁÓÚΪʲôȡÃûΪ2£¬ÒòΪÉèÖÃÁËÁ½ÖÖдÈëÒ³Ã棬¸Â¸Â*/
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÁôÑÔ</title>
</head>
<body>
<form method="post" action
Ïà¹ØÎĵµ£º
ÔÚÊý¾Ý¿â±íÖУ¬¶Ô×ֶν¨Á¢Ë÷Òý¿ÉÒÔ´ó´óÌá¸ß²éѯËٶȡ£¼ÙÈçÎÒÃÇ´´½¨ÁËÒ»¸ö mytable±í£º
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL
);
ÎÒÃÇËæ»úÏòÀïÃæ²åÈëÁË10000Ìõ¼Ç¼£¬ÆäÖÐÓÐÒ»Ìõ£º5555, admin¡£
ÔÚ²éÕÒusername="admin"µÄ¼Ç¼ SELECT * from mytable WHERE username='admin';ʱ£¬Èç¹ ......
½ñÌì×°ÁËһ̨Linuxϵͳ£¬ÒÔÇ°¶¼ÊÇRedHat£¬ºóÀ´Ìý˵ÓÐFedoraÁË£¬Ò»Ö±Ã»Óùý¡£ÕýºÃÏîÄ¿Àï»·¾³ÒªÓþÍÏëŪһ¸öÀ´ÍæÍ棬½á¹ûÏÖÔÚÈ˼Ò×îеÄÊÇCentOS£¬¾ÍÒ»ÕÅCD£¬ÆäËûµÄ¸ù¾ÝÐèÒª×Ô¼ºÉÏÍøDown£¬£¨ÎÒ²»Ï²»¶ÕâÑù×Ó¾Í×Ô¼ºÏÂÔØDVD°æ£©¡£°²×°ÍêÖ®ºóûÓÐͼÐνçÃ棬¶øÇÒûÓÐÌáʾÊäÈërootÃÜÂ룬»¹µÃµ½µ¥Óû§Ä£Ê½ÏÂÐ޸ġ£ºóÀ´ÏÂÔØÁËÒ»¸öͼÐÎ ......
ÒÔmysql-noinstall-5.1.6(win32)ΪÀý
1>°ÑѹËõÎļþmysql-noinstall-5.1.6-alpha-win32.zip½âѹµ½Ò»¸öĿ¼Ï£¬ÔÚ»·¾³±äÁ¿ÖÐÉèÖÃMYSQL_HOME£¬°Ñ%MYSQL_HOME%\bin ¼Ó
Èëµ½ path¡£
2>´´½¨my.iniÅäÖÃÎļþ,ÄÚÈÝÈçÏ£º
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=...\mysql
datadir=...\mysql\data
my.iniÎ ......
¡¡¡¡ÒÔMySQL-server-4.0.14-0.i386.rpmΪÀý£¬·ÅÔÚ/dataĿ¼ÏÂ
¡¡¡¡cd /data
¡¡¡¡rpm -ivh MySQL-server-4.0.14-0.i386.rpm
¡¡¡¡°²×°Íê³ÉºóÔÚ/usr/share/mysqlĿ¼ÖлáÓÐÒ»¸ömysqlµÄÆô¶¯½Å±¾mysql.server¼°Ê¾ÀýÅäÖÃÎļþµÈ(Èçmy-huge.cnf¡¢my-large.cnf¡¢my-medium.cnf)
¡¡¡¡¿½±´Ò»¸öʾÀýÅäÖÃÎ ......
import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
public static void main(String[] args)throws Exception {
Connection conn=null;
//====Á¬½ÓACCESSÊý¾Ý¿â ......