C#.NETÁ¬½Ómysql·½·¨
mysql.data.dll¿½±´µ½binÏÂÃæ²¢ÒýÓÃÒ»ÏÂ
using MySql.Data.MySqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string myConnectionString = "Database=test;Data Source=localhost;User Id=root;Password=admin";
MySqlConnection mycn = new MySqlConnection(myConnectionString);
try
{
mycn.Open();
Response.Write("<mce:script type="text/javascript"><!--
alert('Á¬½Ó³É¹¦')
// --></mce:script>");
}
catch (Exception ex)
{
Response.Write("<mce:script type="text/javascript"><!--
alert(" ex.ToString() ")
// --></mce:script>");
}
}
}
Ò²¿ÉÒÔÅäÖÃapp.config (web.config):
<appSettings>
<add key="Con" value="Provider=MySQLProv;Data Source=test;User Id=root;Password=admin;pooling=false;CharSet=utf8;port=3306"/>
</appSettings>
Ïà¹ØÎĵµ£º
±à¼my.cnfÎļþ£¬¼ÓÈ룺
log-slow-queries[=file] #ĬÈÏΪdataĿ¼ÏµÄhostname-slow.logÎļþ
long_query_time=10 (seconds) #Âý²éѯµÄthreshold
log-queries-not-using-indexes #¼Ç¼²»Ê¹ÓÃË÷ÒýµÄ²éѯ
mysqldumpslowÃüÁî»ñµÃÈÕÖ¾ÖÐÏÔʾµÄ²éѯժҪÀ´´¦ÀíÂý²éÑ¯È ......
winform주
//´æ´¢
private void MemoryImage()
{
string sql = "";
&nbs ......
mysql½¨Á¢Ò»¸ö±í¸ñ£º
create table hyhtbsc(
id int(4) primary key auto_increment,
username varchar(20),
password varchar(20)
);
²éѯÊý¾Ý¿âÄÚÈÝ£º
<?php
$conn = mysql_connect("localhost","root","pass");
mysql_select_db("mydb",$conn);
$sql = "select * from mytable";
$result = mysql_query($ ......
Æô¶¯£ºnet start mySql;
¡¡¡¡½øÈ룺mysql -u root -p/mysql -h localhost -u root -p databaseName;
¡¡¡¡ÁгöÊý¾Ý¿â£ºshow databases;
¡¡¡¡Ñ¡ÔñÊý¾Ý¿â£ºuse databaseName;
¡¡¡¡Áгö±í¸ñ£ºshow tables£»
¡¡¡¡ÏÔʾ±í¸ñÁеÄÊôÐÔ£ºshow columns from tableName£»
¡¡¡¡½¨Á¢Êý¾Ý¿â£ºsource fileName.txt;
¡¡¡¡Æ¥Åä× ......