mysqlÁ¬½Ó²âÊÔ³ÌÐò
<%@ 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","789+");
Statement statement = connection.createStatement();
String sql="SELECT * from admin";
ResultSet rs = statement.executeQuery(sql);
ResultSetMetaData rmeta = rs.getMetaData();
int numClumns=rmeta.getColumnCount();
while(rs.next())
{
%>
<tr bgcolor="#CCCCCC">
<td><div align="center"><%=rs.getString(1)%></div></td>
<td><div align="center"><%=rs.getString(2)%></div></td>
<td><div align="center">
<form id="<%="form" + rs.getString(1)%>" method="post" action="del.jsp" >
<input type="hidden" name="id" id="id" value="<%=rs.getString(1)%>"/>
<input type="submit" name="ɾ³ý" id="ɾ³ý" value="ɾ³ý" />
</form>
</div></td>
</tr>
<%
}
%>
<p>
<%
out.println("<br>");
out.println("Êý¾Ý¿â²Ù×÷³É¹¦£¬¹§Ï²Äã!");
rs.close();
statement.close();
connection.close();
}
catch(Exception e)
{
e.printStackTrace();
out.println("Êý¾Ý¿âÁ´½Óʧ°Ü£¡");
}
%>
Ïà¹ØÎĵµ£º
EXPLAIN ÊÇmysql½âÊÍselect²éѯµÄÒ»¸ö¹Ø¼ü×Ö,¿ÉÒԺܷ½±ãµÄÓÃÓÚµ÷ÊÔ
Óï·¨¸ñʽÈçÏÂ
EXPLAIN tbl_name
»òÕß:
EXPLAIN SELECT select_options
EXPLAIN Óï¾ä¿ÉÒÔ±»µ±×÷ DESCRIBE µÄͬÒå´ÊÀ´Óã¬Ò²¿ÉÒÔÓÃÀ´»ñÈ¡Ò»¸öMySQLÒªÖ´ÐÐµÄ SELECT Óï¾äµÄÏà¹ØÐÅÏ¢¡£
EXPLAIN tbl_name Óï·¨ºÍ DESCRIBE tbl_name »ò SHOW COLUMNS ......
Èç¹ûÒªÁ˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ£¬Ê×ÏÈÁ˽âÒ»ÏÂMySQLµÄÈýÖÖËø¶¨ÀàÐÍ£º
Ò»£¬Ðм¶Ëø¶¨
¶þ£¬±í¼¶Ëø¶¨
Èý£¬Ò³¼¶Ëø¶¨
ÕâÈýÖÖËø¶¨ÀàÐÍ£¬ÔÚMySQLÊý¾Ý¿âÖÐʹÓÃÈçÏ£º
Ðм¶Ëø¶¨£ºMyISAM£¬Memory£¬CSV[·ÇÊÂÎñÐԵĴ洢ÒýÇæ]
±í¼¶Ëø¶¨£ºInnoDB£¬NDB Chuster
Ò³¼¶Ëø¶¨£ºBerkeley DB
Á½ÖÖËø¶¨»úÖÆ£º¶ÁËø¶¨ºÍдËø¶¨
MySQLÊý¾Ý¿âËø¶ ......
ÔÚÉú²úÓ¦ÓÃÖУ¬Ä³Ì¨“Nginx+PHP+MySQL”½Ó¿ÚÊý¾Ý·þÎñÆ÷£¬°çÑݵĽÇÉ«Ê®·ÖÖØÒª£¬Èç¹û·þÎñÆ÷Ó²¼þ»òNginx¡¢MySQL·¢Éú¹ÊÕÏ£¬¶ø ¶Ìʱ¼äÄÚÎÞ·¨»Ö¸´£¬ºó¹û½«·Ç³£ÑÏÖØ¡£ÎªÁ˱ÜÃâµ¥µã¹ÊÕÏ£¬ÎÒÉè¼ÆÁË´ËÌ×·½°¸£¬±àдÁËfailover.sh½Å±¾£¬ÊµÏÖÁËË«»ú»¥±¸¡¢È«×Ô¶¯Çл»£¬¹ÊÕÏתÒÆʱ¼ä Ö»Ð輸ʮÃë¡£
Ò»¡¢Ë«»ú»¥±¸¡¢È«×Ô¶¯Çл»·½°¸ ......
ת×Ô http://www.supidea.com/post/mysql_design_database.aspx
MySQLÊý¾Ý¿âÉè¼ÆÔÔò
MySQL¶ÔÓÚ³ÉΪһ¸ö·Ç³£¿ìËÙµÄÊý¾Ý¿â·þÎñÆ÷ÓÐ×ŵ±Ö®ÎÞÀ¢µÄÃûÉù£¬ËüÒ²·Ç³£ÈÝÒ×ÉèÖúÍʹÓá£Ëæ×ÅËü×÷ΪÍøÕ¾ºó¶ËÊý¾Ý¿âµÃÉùÍûÈÕÔö£¬ÆäЧ¹ûÔÚÈ¥Ä꿪ʼÓÐÃ÷ ÏÔÌá¸ß¡£µ«ÊǺܶàMySQLÓû§¸ü¶àµØÖªµÀÈçºÎ´´½¨Ò»¸öÊý¾Ý¿â²¢±àд¶ÔËüµÄ²éѯ¡£¾ÍÏñ³ÉÇ ......
sudo apt-get install mysql-server
Õâ¸öÓ¦¸ÃºÜ¼òµ¥ÁË£¬¶øÇÒÎÒ¾õµÃ´ó¼ÒÔÚ°²×°·½ÃæҲûʲô̫´óÎÊÌ⣬ËùÒÔÒ²¾Í²»¶à˵ÁË£¬ÏÂÃæÎÒÃÇÀ´½²½²ÅäÖá£
ÅäÖÃMySQL
×¢Ò⣬ÔÚUbuntuÏÂMySQLȱʡÊÇÖ»ÔÊÐí±¾µØ·ÃÎʵģ¬Èç¹ûÄãÒªÆäËû»úÆ÷Ò²Äܹ»·ÃÎʵĻ°£¬ÄÇôÐèÒª¸Ä±ä/etc/mysql/my.cnfÅäÖÃÎļþÁË£¡ÏÂÃæÎÒÃÇÒ»²½²½µØÀ´£º
ĬÈϵÄMySQL°²× ......