SpringÅäÖÃmysqlÊý¾Ý¿â
<! -- beans ÔªËØÊÇSpringÅäÖÃÎļþµÄ¸ùÔªËØ£¬ËùÓеÄSpring µÄÅäÖÃÎļþ¶¼Ó¦°´ÈçϽṹÊéдһ¡µ
<beans>
<!Ò»ÅäÖÃid ΪdataSource µÄbean£¬¸Ãbean ÊǸöÊý¾ÝԴʵÀýÒ»¡µ
<bean ¹¤d="dataSource" class="org.apache.corrunons.dbcp.BasicDataSource"
destroy-method="close">
<! È·¶¨Êý¾ÝÔ´µÄÇý¶¯-->
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- È·¶¨Á¬½ÓÊý¾Ý¿âµÄurl -- >
<property name= "url " >
<!-- j2ee ÊÇÐèÒªÁ¬½ÓµÄÊý¾Ý¿âÃû-->
<value>jdbc:mysql://localhost:3306/j2ee</value>
</property>
<!--È·¶¨Á¬½ÓÊý¾Ý¿âµÄÓû§Ãû-->
<property name="username">
<! -- root ÊÇÁ¬½ÓÊý¾Ý¿âµÄÓû§Ãû-->
<value>root</value>
</property>
<!һȷ¶¨Á¬½ÓÊý¾Ý¿âµÄÃÜÂë>
<property name="password">
<!Ò»pass ÊÇÁ¬½ÓÊý¾Ý¿âµÄÃÜÂë…¡µ
<value>pass</value>
</property>
</bean>
</beans>
Ïà¹ØÎĵµ£º
Ô¶³ÌÁ¬½Ó·þÎñÆ÷³öÏÖÒÔÉÏ´íÎó
Ö÷ÒªÓÐÈý¸öÔÒò£º
1¡¢mysqlÊÚȨ±íÀïûÓÐÔ¶³Ì»úÆ÷µÄȨÏÞ£¬¼°ÐèÒªÔÚÊÚȨ±ímysql.userÌí¼Ó
grant all privileges on *.* to 'root'@'Ô¶³ÌµÇ½IP' identified by 'Ô¶³ÌµÇ½ÃÜÂë'
flush privileges;
2¡¢ÍøÂ粻ͨ£¬Õâ¸ö¾Í²»ËµÁË¡£
3¡¢·À»ðǽ½ûÖ¹3306¶Ë¿Ú£¬ÒÔiptableΪÀý
vi /etc/sysconfig/ipt ......
http://dev.mysql.com/doc/refman/5.1/zh/index.html
(MySql 5.1 ÖÐÎIJο¼ÊÖ²á)
*------------------------------------------------------------------------------------------
show databases; ÏÔʾÊý¾Ý¿â
drop database Êý¾Ý¿âÃû;ɾ³ýÊý¾Ý¿â
set names 'utf8';ÉèÖÃÊý¾Ý¿â±àÂëΪutf-8
source x:\Êý¾Ý¿âÃû.sql;µ¼È ......
create database sample;
create table 't_user' (
'id' int(11) not null auto_increment,
'name' varchar(100) not null default '',
primary key ('id')
) type=myisam;
Ñ¡ÏîÖ»ÔÚMySQL 3.23ºÍÒÔºó°æ±¾Öб»ÊµÏÖ¡£
²»Í¬µÄ±íÀàÐÍÊÇ£º
ISAM ÔÀ´µÄ±í´¦ÀíÆ ......
Êý¾Ý¿âÌصã
££Ê¹ÓÃpartition£¬´æÔÚÉÏ°Ù¸ö·ÖÇø
££½¨±íʱָ¶¨ÁËdata_dirºÍindex_dir£¬Êý¾Ý²»ÊÇ´æ´¢ÔÚĬÈÏλÖ㬶øÊÇÔÚmysqldµÄÊý¾ÝĿ¼ÏÂlinkµ½ÕæÕýµÄÊý¾ÝÎļþ
±¸·Ý»Ö¸´ÒªÇó
££±¸·Ý³öÀ´µÄÊý¾Ý»Ö¸´Ê±Òª»Ö¸´³É²»Í¬µÄ±íÃû
££»Ö¸´³öÀ´µÄÊý¾Ýʵ¼Ê´æ´¢Î»ÖÃÒ²Òª´æ´¢ÔÚÓëÔ±í²»Í¬µÄλÖÃ
ÎÊÌâ
Èç¹ûÖ±½Ómysqldump£sourc ......
·µ»ØÀ´×ÔÓÚ²ÎÊýÁ¬½áµÄ×Ö·û´®¡£Èç¹ûÈκβÎÊýÊÇNULL£¬·µ»ØNULL¡£¿ÉÒÔÓг¬¹ý2¸öµÄ²ÎÊý¡£Ò»¸öÊý×Ö²ÎÊý±»±ä»»ÎªµÈ¼ÛµÄ×Ö·û´®ÐÎʽ¡£
mysql> select CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql> select CONCAT('My', NULL, 'QL');
-> NULL
mysql> select CONCAT(14.3);
-> '14.3'
È磺update test set ......