JDBCÁ¬½ÓMySQLÊý¾Ý¿âʵÏÖÔöɾ²é¸Ä
package com.qll.operate;
import java.sql.*;
public class OperateUser {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test";
String name = "root";
String password = "123456";
static Connection conn = null;
Statement st = null;
ResultSet rs = null;
String sql = null;
public void add() {
try {
sql = "insert into tuser values(60024054,'È«ÀÚÀÚ','ÄÐ',24,'¹ã¶«Ê¡ÉîÛÚÊÐ')";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
st.executeUpdate(sql);
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void delete() {
try {
sql = "delete from tuser where id=60024054 ";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
st.executeUpdate(sql);
st.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void find() {
try {
sql = "select * from tuser";
Class.forName(driver);
conn = DriverManager.getConnection(url, name, password);
st = conn.createStatement();
rs = st.executeQuery(sql);
while (rs.next()) {
System.out.println(rs.getInt(1) + "\t" + rs.getString(2) + "\t"
+ rs.getString(3) + "\t" + rs.getInt(4) + "\t"
+ rs.getString(5));
}
rs.close();
st.close();
&nb
Ïà¹ØÎĵµ£º
Apache¹Ù·½ÏÂÔصØÖ·£ºapache_2.0.55-win32-x86-no_ssl.msi£¬¸ü¶à°æ±¾ÔÚÕâÀ
php¹Ù·½ÏÂÔصØÖ·£ºphp-5.0.5-Win32.zip£¬¸ü¶à¾µÏñÏÂÔصØÖ·£¬¸ü¶à°æ±¾ÏÂÔØ£»
mysql¹Ù·½ÏÂÔصØÖ·£ºmysql-4.1.14-win32.zip£¬¸ü¶à¾µÏñÏÂÔصØÖ·£¬¸ü¶à°æ±¾ÏÂÔØ¡£
ApacheµÄÅäÖãº
ÎÒÒ»¿ªÊ¼Ôõô¸ã¶¼²»ºÃ£¬ÎÒÉÏÍøÕÒ£¬ÓеÄ˵ÊÇiisµÄÎÊÌ⣬ÓеÄ˵ÊÇ ......
http://blog.163.com/mysqldba@126/blog/static/1315356342009931103834396/
×î½ü¿´ÁË¿´mysqlµÄ״̬±äÁ¿£¬¸Ð¾õºÃ¶à¸úÒÔÇ°×Ô¼ºÏëÏóµÄ²»Ò»Ñù¡£ÎªÁËÒÔºóÄܼ°Ê±·¢ÏÖ×Ô¼ºµÄ´íÎó,¾ÍÏȼÇÏÂÀ´;
http://dev.mysql.com/doc/refman/5.1/en/server-status-variables.html
mysql> show status;
Com_xxx
Óï¾ä¼ÆÊý±äÁ¿±íʾÿ¸öxxx ......
1.INµÄÓ÷¨
IN(value,value1,...) valuesµÄ¸öÊý¸úmax_allowed_packetÏà¹Ø£¬SELECT 2 IN (2,4,'STRING');
NOT IN(value,..)ºÍINÓï·¨Ò»Ñù¡£
2.IF NOT EXISTS
CREATE ... IF NOT EXISTS stm; ...¿ÉÒÔʹDATABASE,TABLE,EVENT¡£ÈçCREATE TABLE IF NOT EXISTS t(id INT);
3.MD5,MySQLÊý¾Ý¿âÌṩÁËmd5¼ÓÃܹ¦Ä ......
Query ProfilerÊÇMYSQL×Ô´øµÄÒ»ÖÖqueryÕï¶Ï·ÖÎö¹¤¾ß£¬Í¨¹ýËü¿ÉÒÔ·ÖÎö³öÒ»ÌõSQLÓï¾äµÄÐÔÄÜÆ¿¾±ÔÚʲôµØ·½¡£Í¨³£ÎÒÃÇÊÇʹÓõÄexplain,ÒÔ¼°slow query log¶¼ÎÞ·¨×öµ½¾«È··ÖÎö£¬µ«ÊÇQuery ProfilerÈ´¿ÉÒÔ¶¨Î»³öÒ»ÌõSQLÓï¾äÖ´Ðеĸ÷ÖÖ×ÊÔ´ÏûºÄÇé¿ö£¬±ÈÈçCPU£¬IOµÈ£¬ÒÔ¼°¸ÃSQLÖ´ÐÐËùºÄ·ÑµÄʱ¼äµÈ¡£²»¹ý¸Ã¹¤¾ßÖ»ÓÐÔÚMYSQL 5.0.37ÒÔ ......