.NETÁ¬½ÓMySqlÊý¾Ý¿âµÄ·½·¨¼°Ê¾Àý
·½·¨Ò»£º
ʹÓÃMySQLÍÆ³öµÄMySQL Connector/Net×é¼þ£¬ ¸Ã×é¼þÊÇMySQLΪADO.NET·ÃÎÊMySQLÊý¾Ý¿âÉè¼ÆµÄ.NETרÓ÷ÃÎÊ×é¼þ¡£Íê³É¸Ã×é¼þºó£¬ÐèÒªÔÚÏîÄ¿ÖÐÒýÓÃÕâ¸ö×é¼þ£¬Ò²¿ÉÒÔÖ±½ÓÔÚÅäÖÃÎļþµÄ<assemblies>½ÚµãÄÚÌí¼ÓÏÂÃæµÄ½Úµã£º
<add assembly="MySql.Data, Version=5.1.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
Ö®ºóÔÚ³ÌÐòÖÐÒýÓÃÃüÃû¿Õ¼äMySql.Data.MySqlClient£¬¼´¿É¿ªÊ¼½øÐÐÁ¬½ÓMySQLÊý¾Ý¿âµÄ²Ù×÷ÁË£¬Ê¾ÀýÈçÏ£º
1protected void MySqlCon()
2{
3 //Êý¾Ý¿âÁ¬½Ó×Ö·û´®¸úÁ¬½ÓSQL SERVERûÓÐÇø±ð
4 string constr = "server=localhost;User Id=root;password=root;Database=test";
5
6 //ÏÂÃæÊ¹ÓÃMySql Connector/netÌṩµÄרÓöÔÏó
7 MySqlConnection mycon = new MySqlConnection(constr);
8 mycon.Open();
9 MySqlCommand mycmd = new MySqlCommand("select * from users", mycon);
10 MySqlDataReader myreader = mycmd.ExecuteReader();
11 while (myreader.Read())
12 {
13 if (myreader.HasRows)
14 {
15 Response.Write(myreader.GetString("email") + "<br/>");
16 }
17 }
18 myreader.Close();
19 mycon.Close();
20
21}
·½·¨¶þ£º
ʹÓÃODBC.NET¡£Ò»°ãÀ´Ëµ£¬ODBC.NETµÄDataProviderÊDZê×¼µÄ.NET¿ò¼Ü£¨1.1¼°ÒÔÉϵİ汾£©µÄÒ»²¿·Ö£¬ËùÒÔ»áºÍºóÕßÒ»Æð×Ô¶¯°²×°ºÃ¡£Ò
Ïà¹ØÎĵµ£º
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%
//Á¬½ÓÊý¾Ý¿â
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection connection= java.sql.DriverManager.getConnection("jdbc:mysql://localhost/dangyuan","root", ......
use mysql
update user set Password=password('newpassword') where User='root';
flush privileges;
Ê×ÏÈÒªÉùÃ÷Ò»µã£¬´ó²¿·ÖÇé¿öÏ£¬ÐÞ¸ÄMySQLÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ģ¬
ËùÒÔÒ»°ãÓû§ÎÞ·¨¸ü¸ÄÃÜÂ룬³ý·ÇÇëÇó¹ÜÀíÔ±¡£
·½·¨Ò»
ʹÓÃphpmyadmin£¬ÕâÊÇ×î¼òµ¥µÄÁË£¬ÐÞ¸Ämysql¿âµ ......
ÈçÈô×ªÔØ±¾ÎÄ£¬Çë×¢Ã÷Ôʼ³ö´¦£ºhttp://hi.baidu.com/hexiong/blog/item/e860e5dd9b0d3ae376c6381a.html
(hexiong@baidu or iihero@CSDN)
ż¶ûÅöµ½ÓÐÈËÎÊʹÓÃmysqlÃüÁîÐУ¬ÀÏÈÃÈËÊäÈë--default-character-set=gbkÖ®ÀàÎÞÁĵÄÑ¡ÏÈÃÈË·³¡£ÈÃÈ˶àÊäÈëÁ˼¸¸ö×Ö·û£¬È·ÊµÓе㲻¶Ô¾¢¡£
¼ÓÉÏÓÐʱºò×Ô¼ºÓÐʱºòDIY£¬ºÜÉÙÔÚwindow ......
MySQL error 2003µÄ½â¾ö¹ý³Ì¸Õ²ÅÂÛ̳³öÏÖ:
error 2003:Can't connect to MySQL server on ..............
ÎÊÌâ:MYSQLÊý¾Ý¿âûÓÐÆô¶¯~
½â¾ö:°Ù¶ÈÁËÒ»ÏÂ,˵µÄ½â¾ö·½·¨¸÷ÖÖ¸÷Ñù,ºÜ¶à.
1\ÔÚ“ÔËÐДÀïÕÒµ½C:\mysql\bin\mysqld-opt.exe ÔËÐоÍÊÇÁË£¡ÕÒÁË,ûÓÐÕâ¸ö¶«Î÷:(
2 ÔÚDosÏÂ cd \mysql ......
¡¡Ò»Ö±À§ÈÅÎÒ¿ì°ëÄêµÄÎÊÌâÖÕÓڵõ½½â¾ö, ·þÎñÆ÷µÄmysqlÀÏÊÇÔËÐÐÒ»¶Îʱ¼ä,×Ô¶¯Í£Ö¹ÁË,±ØÐëÊÖ¶¯Æô¶¯. !
¡¡¡¡ÎÒÕÒÆ«ÍøÉÏËùÓеķ½·¨,µ«Ã»ÓÐÒ»¸öÄܽâ¾ö,ʲôÐÞ¸ÄÅäÖÃÎļþ°¡.¶¨Ê±Æô¶¯.¶¼Ã»Ð§¹û. ¸ù¾Ýר¼Ò¹Û²ì£¬ÕâÑùµÄÀíÂÛºÍÏÖÏó¶¼ÊÇÖµµÃ¸÷λվ³¤Éî˼µÄ£¬ËùÒÔÏ£Íû´ó¼Ò¶à×öÑо¿Ñ§Ï°£¬ÕùÈ¡×ܽá³ö¸ü¶à¸üºÃµÄ¾Ñé!
¡¡¡¡Õâ¸ö·½·¨ÊÇÎÒ ......