ÊÕ¼¯Ò»Ð©mysqlʹÓ÷½·¨
1.linuxÏÂÆô¶¯mysqlµÄÃüÁ
mysqladmin start
/ect/init.d/mysql start (Ç°ÃæΪmysqlµÄ°²×°Â·¾¶)
2.linuxÏÂÖØÆômysqlµÄÃüÁ
mysqladmin restart
/ect/init.d/mysql restart (Ç°ÃæΪmysqlµÄ°²×°Â·¾¶)
3.linuxϹرÕmysqlµÄÃüÁ
mysqladmin shutdown
/ect/init.d/mysql shutdown (Ç°ÃæΪmysqlµÄ°²×°Â·¾¶)
4.Á¬½Ó±¾»úÉϵÄmysql£º
½øÈëĿ¼mysql\bin£¬ÔÙ¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÊäÈëÃÜÂë¡£
Í˳ömysqlÃüÁexit£¨»Ø³µ£©
5.ÐÞ¸ÄmysqlÃÜÂ룺
mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
»ò½øÈëmysqlÃüÁîÐÐSET PASSWORD FOR root=PASSWORD("root");
6.Ôö¼ÓÐÂÓû§¡££¨×¢Ò⣺mysql»·¾³ÖеÄÃüÁîºóÃ涼´øÒ»¸ö·ÖºÅ×÷ΪÃüÁî½áÊø·û£©
grant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
ÈçÔö¼ÓÒ»¸öÓû§testÃÜÂëΪ123£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬ ²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬Èëmysql£¬È»ºó¼üÈëÒÔÏÂÃüÁ
grant select,insert,update,delete on *.* to " Identified by "123";
¶þ¡¢ÓйØmysqlÊý¾Ý¿â·½ÃæµÄ²Ù×÷
±ØÐëÊ×ÏȵǼµ½mysqlÖУ¬ÓйزÙ×÷¶¼ÊÇÔÚmysqlµÄÌáʾ·ûϽøÐУ¬¶øÇÒÿ¸öÃüÁîÒԷֺŽáÊø
1¡¢ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
2¡¢ÏÔʾ¿âÖеÄÊý¾Ý±í£º
use mysql£» £¯£¯´ò¿ª¿â
show tables;
3¡¢ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
4¡¢½¨¿â£º
create database ¿âÃû;
5¡¢½¨±í£º
use ¿âÃû£»
create table ±íÃû(×Ö¶ÎÉ趨Áбí)£»
6¡¢É¾¿âºÍɾ±í:
drop database ¿âÃû;
drop table ±íÃû£»
7¡¢½«±íÖмǼÇå¿Õ£º
delete from ±íÃû;
8¡¢ÏÔʾ±íÖеļǼ£º
select * from ±íÃû;
9¡¢±àÂëµÄÐÞ¸Ä
Èç¹ûÒª¸Ä±äÕû¸ömysqlµÄ±àÂë¸ñʽ£º
Æô¶¯mysqlµÄʱºò£¬mysqld_safeÃüÁîÐмÓÈë
--default-character-set=gbk
Èç¹ûÒª¸Ä±äij¸ö¿âµÄ±àÂë¸ñʽ£ºÔÚmysqlÌáʾ·ûºóÊäÈëÃüÁî
alter database db_name default character set gbk;
Èý¡¢Êý¾ÝµÄµ¼Èëµ¼³ö
1¡¢Îı¾Êý¾Ýתµ½Êý¾Ý¿âÖÐ
Îı¾Êý¾ÝÓ¦·ûºÏµÄ¸ñʽ£º×Ö¶ÎÊý¾ÝÖ®¼äÓÃtab¼ü¸ô¿ª£¬nullÖµÓÃÀ´´úÌæ¡£Àý£
Ïà¹ØÎĵµ£º
Ò»¡¢±íµÄµ¼Èëµ¼³öÓï¾ä¼°Ê±¼ä×Ö·û´®²¿·Ö´¦Àíº¯Êý
µ¼³öÊý¾Ý¿âËùÓбíµÄ½á¹¹ mysqldump -uroot -proot db_name -d > d:/export_db.sql(½áβ²»Ó÷ֺÅ)
µ¼³öÊý¾Ý¿âij¸ö±íµÄ½á¹¹ mysqldump -uroot -proot db_n ......
InnoDBºÍMyISAMÊÇÔÚʹÓÃMySQL×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬¸÷ÓÐÓÅȱµã£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£ÏÂÃæÊÇÒÑÖªµÄÁ½ÕßÖ®¼äµÄ²î±ð£¬½ö¹©²Î¿¼¡£
innodb
InnoDB ¸ø MySQL ÌṩÁ˾ßÓÐÊÂÎñ(commit)¡¢»Ø¹ö(rollback)ºÍ±ÀÀ£ÐÞ¸´ÄÜÁ¦(crash recovery capabilities)µÄÊÂÎñ°²È«(transaction-safe (ACID complian ......
Hibernate ÅäÖÃͨ¹ýc3p0Á¬½ÓMYSQL
** ÐèÒªµÄ°ü: c3p0_versionxx.jar
** hibernate.cfg.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
&n ......
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec …]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD INDEX [index_name] (index_col_name,…)
or ADD PRIMARY KEY (index_col_name,&hell ......
Ò»¡¢Ê²Ã´ÊÇË÷Òý£¿
Ë÷ÒýÓÃÀ´¿ìËÙµØÑ°ÕÒÄÇЩ¾ßÓÐÌض¨ÖµµÄ¼Ç¼£¬ËùÓÐMySQLË÷Òý¶¼ÒÔB-Ê÷µÄÐÎʽ±£´æ¡£Èç¹ûûÓÐË÷Òý£¬Ö´ÐвéѯʱMySQL±ØÐë´ÓµÚÒ»¸ö¼Ç¼¿ªÊ¼É¨ÃèÕû¸ö±íµÄËùÓмǼ£¬Ö±ÖÁÕÒµ½·ûºÏÒªÇóµÄ¼Ç¼¡£±íÀïÃæµÄ¼Ç¼ÊýÁ¿Ô½¶à£¬Õâ¸ö²Ù×÷µÄ´ú¼Û¾ÍÔ½¸ß¡£Èç¹û×÷ΪËÑË÷Ìõ¼þµÄÁÐÉÏÒѾ´´½¨ÁËË÷Òý£¬MySQLÎÞÐèɨÃèÈκμǼ¼´¿ÉѸËٵà ......