MySQL³£ÓÃÃüÁî×ܽá
ÔÎÄÁ´½Ó£ºhttp://bbs.linuxtone.org/thread-991-1-1.html
ITÔËάר¼ÒÍø--"×ÔÓÉƽµÈ£¬»¥Öú·ÖÏí£¡"
===MySQL»ù´¡====
mysql
ÏÂÔØ
: http://www.mysql.com/
mysqld ³£¹æMySQL·þÎñÆ÷
mysqld-opt ÓÅ»¯
mysql·þÎñ
Æ÷,ÌṩһЩ¹¦ÄÜ¿ÉÒÔÍÚ¾ò¸üºÃµÄ¹¦ÄÜ
mysqld-max ÓëmysqldÒ»Ñù,µ«¿ÉÒÔÖ§³Ö¸üÐÂ,¸ü¾ßʵÑéÐÔÖʵŦÄÜ(¸ü²»Îȶ¨)
++°²×°mysql
²Î¼û×Ô´øµÄINSTALL-SOURCEÎļþ
$ ./configure –prefix=/app/mysql-5.0.51a –with-charset=utf8 –with-extra-charsets=gbk,gb2312,utf8
++Æô¶¯/¹Ø±Õmysql
$ path/mysqld_safe -user=mysql &
$ /mysqladmin -p shutdown
++ÐÞ¸Äroot¿ÚÁî
$ mysqladmin -u root -p password ‘ÐÂÃÜÂë’
++²é¿´·þÎñÆ÷״̬
$ path/mysqladmin version -p
++Á¬½ÓÔ¶¶Ëmysql·þÎñÆ÷
$ path/mysql -u Óû§
Ãû -p #Á¬½Ó±¾»ú
$ path/mysql -h Ô¶³ÌÖ÷»úIP -u Óû§Ãû -p#Á¬½ÓÔ¶³ÌMYSQL·þÎñÆ÷
++´´½¨/ɾ³ý Êý¾Ý
¿â»ò±í
$ mysqladmin -u root -p create xxx
mysql> create database Êý¾Ý¿âÃû;
mysql> create TABLE items (
id INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
symbol CHAR(4) NOT NULL,
username CHAR(8),
INDEX sym (symbol),INDEX …..
UNIQUE(username)
) type=innodb;
mysql> drop database [if exists] Êý¾Ý¿âÃû
mysql> create table ±íÃû;
mysql> drop table ±íÃû;
++²é¿´Êý¾Ý¿âºÍ²é¿´Êý¾Ý¿âϵıí
mysql> show databases;
mysql> show tables;
mysql> show table status;
mysql> desc ±íÃû; #²é¿´¾ßÌå±í½á¹¹ÐÅÏ¢
mysql> SHOW CREATE DATABASE db_name #ÏÔʾ´´½¨db_name¿âµÄÓï¾ä
mysql> SHOW CREATE TABLE tbl_name #ÏÔʾ´´½¨tbl_name±íµÄÓï¾ä
++´´½¨Óû§
mysql> grant select,insert,update,delete,alter on mydb.* to test2@localhost identified by “abc”;
mysql> grant all privileges on *.* to test1@”%” identified by “abc”;
mysql> flush privileges;
++Óû§¹ÜÀí
mysql> update user set password=password (’11111′) where user=’test1′; #ÐÞ¸Ätest1ÃÜÂëΪ111111
mysql> DELETE from user WHERE User=”testuser” and Host=”loca
Ïà¹ØÎĵµ£º
Scale Out£ººáÏòÀ©Õ¹£¬Ôö¼Ó´¦Àí½ÚµãÌá¸ßÕûÌå´¦ÀíÄÜÁ¦
Scale Up£º×ÝÏòÀ©Õ¹£¬Í¨¹ýÌáÉýµ¥¸ö½ÚµãµÄ´¦ÀíÄÜÁ¦´ïµ½ÌáÉýÕûÌå´¦ÀíÄÜÁ¦µÄÄ¿µÄ
Replication
MySQLµÄreplicationÊÇÒì²½µÄ£¬ÊÊÓÃÓÚ¶ÔÊý¾ÝʵʱÐÔÒªÇó²»ÊÇÌرð¹Ø¼üµÄ³¡¾°¡£slave¶ËµÄIOÏ̸߳ºÔð´Ómaster¶ÁÈ¡ÈÕÖ¾£¬SQLÏß ³ÌרߺÔðÔÚslave¶ËÓ¦ÓôÓmaster¶Á¹ýÀ´µÄÈÕÖ¾£¨ÔçÆÚ ......
×öÊý¾Ý¿âµ÷ÓÅ£¬Ò»¸ö¼òµ¥µÄtip¾ÍʹÐÔÄÜÌáÉýÒ»´ó¿éʱ£¬±»°ïÖúµÄÈË×ÔÈ»ÊǸßÐ˶øÇҸм¤£¬ÎÒÒ²ÊÇÂúÐÄ»¶Ï²¡£ÓÃËùѧ°ïÖúÁËËûÈË£¬Ò²ËµÃ÷»¹ÊÇÓÐÒ»¼¼Ö®³¤µÄ£¬ÓÐÒ»ÃÅÄܹ»Ñø»î×Ô¼ºµÄÊÖÒÕ¡£Ò²ËãÊÇÊÖÒÕÈË°¡¡£
ͬÊÂÈÃÎÒ°ïÖúÓÅ»¯£¬ÔÚslow query logÀï·¢ÏÖÓÐÁ½¸öSQLÖ´ÐеĴÎÊý×î¶à£¬²¢ÇÒÿ´Î¶¼ÔÚÁ½ÃëÒÔÉÏ¡£ÓÃexplain¿´ÁË£¬Ò²Î´·¢ÏÖË÷ÒýʹÓ÷ ......
Author: Ivan@mysqlab.net/Ì·¿¡Çà תÔØÇë×¢Ã÷À´Ô´URIÁ´½Ó:
http://www.mysqlab.net/blog/2009/04/mysql-54µÄÐÂÌØÐÔ½âÎö/
MySQL 5.4 Ö®ËùÒÔÃüÃûΪ5.4£¬¶ø²»ÊÇ5.2 ÊÇÒòΪ֮ǰµÄ5.2°æ±¾±»ÃüÃûΪ6.0ÁË£¨Õâ¸öÓ¦¸ÃÊÇÉÌÒµÉϵÄÔÒò£¬¾ÍÏñjava1.6±»ÃüÃûΪ6.0£©¡£ÏÖÔÚµÄ5.4 preview release ÊÇÔÚµ±Ç°MySQL5.1µÄ»ù´¡ÉÏ£¬¶Ô Innodb ½ø ......
Ò». Æô¶¯²ÎÊýÓÅ»¯
ÐÞ¸Ä my.cnf (»òÕßmy.ini)£¬¼ÓÈë/ÐÞ¸ÄÒÔϼ¸ÐÐ
#É趨»º´æµÄÁ¬½ÓÊý,½ÚÊ¡Á¬½ÓʱµÄ¿ªÏú
back_log = 64
#½ûÓÃÎļþϵͳÍⲿËø
external-locking = 0
#½ûÓÃBDB,Èç¹ûÄãȷʵ²»ÐèÒªµÄ»°,innodbÒ²ÊÇÈç´Ë
skip-bdb
#Ë÷Òý»º³å,Èç¹ûÊÇרÓõÄÊý¾Ý¿â·þÎñÆ÷,¿ÉÒÔÉèÖøߴï·þÎñÆ÷ÄÚ´æµÄÒ»°ë,Èç¹û²»ÊÇרÓõÄ,
#»¹ÊÇÉ ......
InnoDBÊÇmysqlÊý¾Ý¿âÖÐΨһһ¸öÖ§³ÖÍâ¼üµÄÒýÇ棬µ«ÊDzîÖµµÄʱºòÈ´µÃ×¢ÒâÒ»ÏÂ
±ÈÈçÓÐÁ½ÕÅ±í£¬album(id,name,path) £¬picture(id,name,path,parent_album)£¬ÆäÖбí2ÖÐparent_albumÊÇÍâ¼ü
´Ëʱ²îÖµinsert into picture (name,path,parent_album) values ("pic","path",68) (68ÊÇÒ»¸öÏà²áµÄid)
mysql»á±¨´í"Failed to read a ......