ÀûÓÃMySQLDriverCSʵÏÖÔÚ.NET»·¾³Ï·ÃÎÊMySQLÊý¾Ý¿â
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySQLDriverCS;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MySQLConnection conn = null;
conn = new MySQLConnection(new MySQLConnectionString("127.0.0.1", "Dvbbs", "root", "123456").AsString);
conn.Open();
MySQLCommand commn = new MySQLCommand("set names gb2312",conn);
commn.ExecuteNonQuery();
string sql = "select title,topicID, boardId ,dateandtime,hits from Dv_topic order by dateandtime desc limit 10";
MySQLDataAdapter mda = new MySQLDataAdapter(sql,conn);
DataSet ds = new DataSet();
mda.Fill(ds, "table1");
this.Repeater1.DataSource = ds;
this.Repeater1.DataBind();
conn.Close();
}
}
¾ÍÕâÑù¾Í¿ÉÒÔʵÏÖÔÚ.NET»·¾³Ï¶ÔMySQLÊý¾ÝµÄ·ÃÎÊ¡£ÔÚÕâ֮ǰ»¹Òª×öһЩ׼±¸£¬ÏÂÔØMySQLDriverCS£¬°²×°£¬ÔÚ°²×°Îļþ¼ÐÏÂÃæÕÒµ½MySQLDriver.dll£¬È»ºó½«MySQLDriver.dllÌí¼ÓÒýÓõ½ÏîÄ¿ÖоÍOKÁË¡£Ò²ÐíÄã¶ÔÕâÐдúÂë
MySQLCommand commn = new MySQLCommand("set names gb2312",conn);
commn.ExecuteNonQuery();
²»Ì«Àí½â¡£ÕâÊÇÒòΪÈç¹ûûÓÐÕâ¾ä»
Ïà¹ØÎĵµ£º
windows2003----¿ªÊ¼----ÔËÐÐ---mysql -uroot -p£¬½øÈëMYSQLÊý¾Ý¿â£¬ÊäÈëÃÜÂ룬µÇ½¡£
show databases;¿´¿´ÓÐÄÄЩÊý¾Ý¿â
use xxxxxx£»(xxxxxxΪÊý¾Ý¿âÃû£¬½øÈëÊý¾Ý¿â)
update user set passwd=MD5('111111*') where user_name = 'admin';£¨111111ΪҪÐ޸ĵÄÃÜÂ룩 ......
ÔÚÖ÷Íâ¼ü±í´æÔÚ¹ØϵµÄʱºòÈç¹û¼ÓÉÏ"lazy=true"µÄ»°£¬Ôò±íÃ÷ÑÓ³Ù£¬¼´Ö»²éѯÖ÷±íÖеÄÄÚÈÝ£¬¶ø²»²éѯÍâ¼ü±íÖеÄÄÚÈÝ¡£
Àý£º
<hibernate-mapping>
<class name="com.pojo.Sortp" table="sortp" catalog="shjdc">
<id name="id" type= ......
1¡¢ÔÚlinuxÏ£º
²é¿´mysql ÊÇ·ñÔËÐУºps -ef | grep myslq
Èç¹û MySQL ÕýÔÚÔËÐУ¬Ê×ÏÈɱ֮: kill mysqlµÄ½ø³ÌºÅ¡£
¡¡¡¡Æô¶¯ MySQL :/usr/bin/safe_mysqld --skip-grant-tables &
¡¡¡¡¾Í¿ÉÒÔ²»ÐèÒªÃÜÂë¾Í½øÈë MySQL ÁË¡£
¡¡¡¡È»ºó¾ÍÊÇ
¡¡¡¡>use mysql
¡¡¡¡ ......
#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;
......