ÊÕ¼¯Ò»Ð©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ÖµÓÃÀ´´úÌæ¡£Àý£
Ïà¹ØÎĵµ£º
»·¾³ rhel5.4
×°ºÃgcc ºÍÏàÓ¦µÄ¿â¡£ÎÒÕâ±ßÓöµ½curses¡£DebianϵͳµÄ»°Ðè°²×°apt-get install libncurses5-dev¡£
ÏÂÔØmysqlÔ´Âë°ü£¬ÎÒ×Ô¼ºÔÚmyslq¹Ù·½ÍøÕ¾ÉÏÏÂÁËÒ»¸ö“mysql-5.0.87.tar.gz”
cd /usr/local/src/
½â°ü tar zxvf mysql-5.0.87.tar.gz
cd mysql-5.0.87
./configure --prefix=/usr/local/servic ......
²»Í¬Êý¾Ý¿âÖ®¼äµÄÓï·¨²îÒ컹Õæ²»ÉÙ~Òª±ÀÀ£ÁË¡£
1.´´½¨´ø×ÔÔöÁÐÁÙʱ±í£ºcreate TEMPORARY table t(id int AUTO_INCREMENT PRIMARY key, u_name varchar(50));--Ϊʲô±ØÐëÒªÖ÷¼ü£¿£¡
ÏòÕâ¸öÁÙʱ±íÖвåÈëÊý¾Ý£ºinsert into t values(null, 'zdy');--Ϊʲôһ¶¨Òª¼Ónull£¿£¡
2.°ÑÒ»ÕűíµÄ²éѯ½á¹û²åÈëÁÙʱ±í£ºinsert into t ......
ÆÕͨMySQLÔËÐУ¬Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿²»´óµÄ»°£¬ÊÇ×ã¹»¿ìµÄ£¬µ«Êǵ±Êý¾ÝÁ¿ºÍ·ÃÎÊÁ¿¾çÔöµÄʱºò£¬ÄÇô¾Í»áÃ÷ÏÔ·¢ÏÖMySQLºÜÂý£¬ÉõÖÁdownµô£¬ÄÇô¾ÍÒª¿¼ÂÇÓÅ»¯ÎÒÃǵÄMySQLÁË¡£
ÓÅ»¯ÎÞ·ÇÊÇ´ÓÈý¸ö½Ç¶ÈÈëÊÖ£º
µÚÒ»¸öÊÇ´ÓÓ²¼þ£¬Ôö¼ÓÓ²¼þ£¬Ôö¼Ó·þÎñÆ÷
µÚ¶þ¸ö¾ÍÊǶÔÎÒÃǵÄMySQL·þÎñÆ÷½øÐÐÓÅ»¯£¬Ôö¼Ó»º´æ´óС£¬¿ª¶à¶Ë¿Ú£¬¶Áд·Ö¿ª
µÚÈý¸ö ......
×î½üÍøÕ¾Êý¾ÝÁ¿½Ú½ÚÅÊÉý£¬¾ÝBD·½Ãæͨ±¨¶ÌÆÚÄÚUV»¹ÒªÉÏÉý30%-50%¡£µ±Ç°×îÍ»³öµÄÎÊÌâÊǺǫ́ÄÚÈÝÉóºËϵͳѹÁ¦Ì«´ó£¬ÒѾÖð½¥Á¦²»´ÓÐÄ¡£¾¡¹Ü¼ÓÁËһЩӲ¼þµ«Ð§¹û²¢²»ÊÇÌ«ÀíÏ룬Ö÷Òª»¹ÊÇÇ°Ò»¶Îʱ¼ä°Ñ¹¤×÷Öص㶼·ÅÔÚÇ°¶ËÄ£¿éÉÏÁË¡£ÄÚÈݹÜÀíƽ̨µÄ²¿·Ö´úÂëûÓÐ×ÐϸÕå×᣽ÓÏÂÀ´Ò»¶Îʱ¼ä¼¯Öо«Á¦ÓÅ»¯ºǫ́¡£
Ê×ÏȽ«¶à±íÁ¬²éµÄSQLÄóö ......
1¡¢¿´»úÆ÷ÅäÖã¬Ö¸Èý´ó¼þ£ºcpu¡¢ÄÚ´æ¡¢Ó²ÅÌ
2¡¢¿´mysqlÅäÖòÎÊý
3¡¢²éϵmysqlÐÐ״̬£¬¿ÉÒÔÓÃmysqlreport¹¤¾ßÀ´²é¿´
4¡¢²é¿´mysqlµÄÂý²éѯ
ÒÀ´Î½â¾öÁËÒÔÉÏÎÊÌâÖ®ºó£¬ÔÙÀ´²éÕÒ³ÌÐò·½ÃæµÄÎÊÌâ
my.cnf»º´æÓÅ»¯
ÔÚ my.cnf ÖÐÌí¼Ó/ÐÞ¸ÄÒÔÏÂÑ¡Ïî:
#È¡ÏûÎļþϵͳµÄÍⲿËø
skip-locking
#²»½øÐÐÓòÃû·´½âÎö,×¢Òâ ......