mysql³£ÓÃÃüÁî
1¡¢mysqlÊý¾Ý¿âÓÐÁ½ÖÖÇý¶¯£º
MySQL Connector/J Driver¡¢MMMysql driver¡£
2¡¢µ¼Èëµ¼³öÊý¾Ý¿âÃüÁ£¨binĿ¼Ï£©
µ¼³ö£ºmysqldump -u root -p bokele >c:/mysql.sql --default-character-set=gbk
µ¼È룺C:\mysql\bin\> mysql -u root -p
˵Ã÷£ºC:\mysql\bin\±íʾ½øÈëmysql³ÌÐò¸ùĿ¼
C:\helloapp\schema\sampledb.sqlÊÇÒªµ¼ÈëÊý¾Ý¿âµÄÎļþµÄλÖÃ
c:/mysql.sqlÊǵ¼³öµÄsqlÎļþ
--default-character-set=gbk Ö¸±àÂ뷽ʽ
3¡¢ÐÞ¸Äroot¿ÚÁ£¨binĿ¼Ï£©
bin>mysql -u root -p
mysql>set password for root@localhost=password('123');
˵Ã÷£º½«rootµÄ¿ÚÁîÉèÖÃΪ123
4¡¢Æô¶¯Í£Ö¹mysql¿Í»§³ÌÐò£¨binĿ¼Ï£©
1£©mysql -u root -p
2£©£¨ÊäÈëÃÜÂ룩
3£©create database SAMPLEDB
4£©user SAMPLE
5£©£¨¸÷ÖÖsql²Ù×÷£©
6£©exit£¨Í˳ö£©
5¡¢Æô¶¯ºÍÍ£Ö¹mysql·þÎñ£¨ÃüÁîÐÐÏ£©
Æô¶¯£ºnet start mysql Í£Ö¹£ºnet stop mysql
6¡¢×¢²áºÍɾ³ýmysql·þÎñ£¨binĿ¼Ï£©
×¢²á£ºmysqld-nt --install ɾ³ý£ºmysqld-nt --remove
7¡¢µ¼ÈëmysqlÊý¾Ý¿âʱ³öÏÖ£ºData too long for column '***' at row *£¬
ÃèÊö£ºmysqlÓÃUTF8×Ö·û¼¯£¬±¸·ÝÎļþ£¨***.sql£©ÊÇgbk¸ñʽµÄ£¬ÔËÐÐC:\mysql\bin\> mysql -u root -p
·ÖÎö£ºÒòΪmysqlÓÃutf8±àÂ룬ËùÒÔÒ»¸ö×Ö½ÚÕ¼24루UTF8×Ö·ûÊǿɱ䳤¶È£¬Ó¢ÎÄ8룬ÖÐÎÄ24λ£¬ÎªÂú×ãÈ«ÊÇÖÐÎÄÇé¿ö£¬ÓÃ24λ±íʾ£©£¬µ«mysqlµÄvarcharÀàÐÍÓÐ×î´ó³¤¶È£¬¶ø255×24¿ÉÄܳ¬¹ý×î´ó³¤¶È£¬ËùÒÔ±¨´í¡£¿É¼ûÔ±¸·ÝÎļþ½¨Êý¾Ý¿âʱӦ¸ÃʹÓõIJ»ÊÇUTF8£¬¶øӦΪһ¸ö×Ö·ûÕ¼8λµÄlatin1±àÂ뷽ʽ£¬ÕÒµ½ÎÊÌâ´ð°¸¡£
½â¾ö£ºÔÚ½¨±íÎļþ¶¥¶Ë¼ÓÈëÒÔÏÂÓï¾ä£º
drop database if exists Web;//WebΪҪ½¨µÄÊý¾Ý¿â
create database Web default charset=latin1 ;
use Web;
set charset latin1;
7. ÅäÖÃ×Ö·û¼¯
½¨¿âʱÅäÖÃ×Ö·û¼¯
create database testxxx default charset=utf8
½¨±íʱÅäÖÃ×Ö·û¼¯
CREATE TABLE `t_agent` (
`ID` smallint(5) NOT NULL
) DEFAULT CHARSET=utf8 ;
ÐÞ¸Ä×Ö·û¼¯
Windowsƽ̨
windowsϵÄmysqlÅäÖÃÎļþÊÇmy.ini,Ò»°ãÔÚc:\windows\my.ini»òÕßc:\winnt\my.ini¿ÉÒÔÖ±½ÓÔÚÕâ¸öÎļþÀïÃæ¼ÓÉÏ
default-character-set=gbk #»ògb2312,big5,utf8
È»ºóÖØÐÂÆô¶¯mysql
se
Ïà¹ØÎĵµ£º
mysqlÓÐÒ»¸ö¹¦ÄܾÍÊÇ¿ÉÒÔlogÏÂÀ´ÔËÐеıȽÏÂýµÄsqlÓï¾ä£¬Ä¬ÈÏÊÇûÓÐÕâ¸ölogµÄ£¬ÎªÁË¿ªÆôÕâ¸ö¹¦ÄÜ£¬
ÒªÐÞ¸Ämy.cnf»òÕßÔÚmysqlÆô¶¯µÄʱºò¼ÓÈëһЩ²ÎÊý¡£Èç¹ûÔÚmy.cnfÀïÃæÐ޸ģ¬ÐèÔö¼ÓÈçϼ¸ÐÐ
long_query_time = 1
log-slow-queries = /var/youpath/slow.log
log-queries-not-using-indexes
long_query_time ÊÇÖ¸Ö´ ......
һֱʹÓÃMysql£¬×î½ü²ÅÁ˽⵽MysqlÖ§³ÖÁËTransaction¡£ÀÏÁË£¬¸ú²»ÉÙ³±Á÷ÁË¡£
ÄǾͰÑÔÀ´µÄÓ¦ÓøijÉBased On TransactionµÄ°É¡£
½«½¨±íÓï¾ä¸Ä³ÉEngine=InnoDB£¬ºÃÏñ»¹ÊDz»ÐУ¬Ã»ÓÐÏëÏóÖÐÄÇô¼òµ¥¡£
²éÒ»²é£¬Å¶£¬·¢ÏÖXAMPP°²×°µÄMysql»¹ÒªÐÞ¸ÄconfÎļþ£º
XAMPP from Apache Friends is a collection of free open s ......
integer »òÕß int
int »òÕß java.lang.Integer
INTEGER
4 ×Ö½Ú
long
long Long
BIGINT
8 ×Ö½Ú
short
short Short
SMALLINT
2 ×Ö½Ú
byte
byte Byte
TINYINT
1 ×Ö½Ú
float
float Float
FLOAT
4 ×Ö½Ú
double
double Double
DOUBLE
8 ×Ö½Ú
b ......
¡¡ÍøÉÏÓкܶàµÄÎÄÕ½ÌÔõôÅäÖÃMySQL·þÎñÆ÷£¬µ«¿¼Âǵ½·þÎñÆ÷Ó²¼þÅäÖõIJ»Í¬£¬¾ßÌåÓ¦ÓõIJî±ð£¬ÄÇЩÎÄÕµÄ×ö·¨Ö»ÄÜ×÷Ϊ³õ²½ÉèÖòο¼£¬ÎÒÃÇÐèÒª¸ù¾Ý×Ô¼ºµÄÇé¿ö½øÐÐÅäÖÃÓÅ»¯£¬ºÃµÄ×ö·¨ÊÇMySQL·þÎñÆ÷Îȶ¨ÔËÐÐÁËÒ»¶Îʱ¼äºóÔËÐУ¬¸ù¾Ý·þÎñÆ÷µÄ”״̬”½øÐÐÓÅ»¯¡£
mysql> show global status;
¡¡¡¡¿ÉÒÔÁгöMySQL·þÎ ......
ÏÂÎç¿´ÁËÒ»¶ÎPHP100µÄÊÓƵ¡£
Ò²ËãÓеãÊÕ»ñ¡£
ÀïÃæµÄÒ»¶Î×ÔдµÄfindallµÄSQLº¯Êý£º
public function findall($table) {
$this->query("SELECT * from $table");
}
ÔÀ´Ö»ÊÇÕâô¼òµ¥£¬¸Õ»¹ÔÚ˼¿¼¡£
ʹÓÃÁËTAB¼üÉÏÃæµÄ¶ÙºÅÀ´ÐÞÊÎMYSQLÀïµÄ×Ö¶ÎÃû£¬È磺
UPDATE tablename SET `fieldname`='values' wh ......