Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MYSQLÖÐEXPLAINµÄ˵Ã÷


 
mysql> explain select count(id) from t_prehandle_zhigao_05 as zhigao where start_time > '2008-05-30';
+----+-------------+--------+-------+---------------+------------+---------+------+---------+--------------------------+
| id | select_type | table  | type  | possible_keys | key        | key_len | ref  | rows    | Extra                    |
+----+-------------+--------+-------+---------------+------------+---------+------+---------+--------------------------+
|  1 | SIMPLE      | zhigao | range | start_time    | start_time | 8       | NULL | 1061762 | Using where; Using index |
+----+-------------+--------+-------+---------------+------------+---------+------+---------+--------------------------+
1 row in set (0.00 sec)
mysql>
EXPLAINÁеĽâÊÍ£º
table£ºÏÔʾÕâÒ»ÐеÄÊý¾ÝÊǹØÓÚÄÄÕűíµÄ
type£ºÕâÊÇÖØÒªµÄÁУ¬ÏÔʾÁ¬½ÓʹÓÃÁ˺ÎÖÖÀàÐÍ¡£´Ó×îºÃµ½×î²îµÄÁ¬½ÓÀàÐÍΪconst¡¢eq_reg¡¢ref¡¢range¡¢indexheºÍALL
possible_keys£ºÏÔʾ¿ÉÄÜÓ¦ÓÃÔÚÕâÕűíÖеÄË÷Òý¡£Èç¹ûΪ¿Õ£¬Ã»ÓпÉÄܵÄË÷Òý¡£¿ÉÒÔΪÏà¹ØµÄÓò´ÓWHEREÓï¾äÖÐÑ¡ÔñÒ»¸öºÏÊʵÄÓï¾ä
key£ºÊµ¼ÊʹÓõÄË÷Òý¡£Èç¹ûΪNULL£¬ÔòûÓÐʹÓÃË÷Òý¡£ºÜÉÙµÄÇé¿öÏ£¬MYSQL»áÑ¡ÔñÓÅ»¯²»×ãµÄË÷Òý¡£ÕâÖÖÇé¿öÏ£¬¿ÉÒÔÔÚSELECTÓï¾ä
ÖÐʹÓÃUSE INDEX£¨indexname£©À´Ç¿ÖÆʹÓÃÒ»¸öË÷Òý»òÕßÓÃIGNORE INDEX£¨indexname£©À´Ç¿ÖÆMYSQLºöÂÔË÷Òý
key_len£ºÊ¹ÓõÄË÷ÒýµÄ³¤¶È¡£ÔÚ²»Ëðʧ¾«È·ÐÔµÄÇé¿öÏ£¬³¤¶ÈÔ½¶ÌÔ½ºÃ
ref£ºÏÔʾË÷ÒýµÄÄÄÒ»Áб»Ê¹ÓÃÁË£¬Èç¹û¿ÉÄܵĻ°£¬ÊÇÒ»¸ö³£Êý
rows£ºMYSQLÈÏΪ±ØÐë¼ì²éµÄÓÃÀ´·µ»ØÇëÇóÊý¾ÝµÄÐÐÊý
Extra£º¹ØÓÚMYSQLÈçºÎ½âÎö²éѯµÄ¶îÍâÐÅÏ¢¡£½«ÔÚ±í4.3ÖÐÌÖÂÛ£¬µ«ÕâÀï¿ÉÒÔ¿´µ½µÄ»µµÄÀý×ÓÊÇUsing temporaryºÍUsing filesort£¬Òâ˼MYSQL¸ù±¾²»ÄÜʹÓÃË÷Òý£¬½á¹ûÊǼìË÷»áºÜÂý
extraÁзµ»ØµÄÃèÊöµÄÒâÒå
Distinct:Ò»µ©MYSQLÕÒµ½ÁËÓëÐÐÏàÁªºÏÆ¥ÅäµÄÐУ¬¾Í²»ÔÙËÑË÷ÁË
Not exists: MYSQLÓÅ»¯ÁËLEFT JOIN£¬Ò»µ©ËüÕÒµ½ÁËÆ¥ÅäLEFT JOIN±ê×¼µÄÐУ¬¾Í²»ÔÙËÑË÷ÁË
Range checked for each Record£¨i


Ïà¹ØÎĵµ£º

ÀûÓÃMySQLµÄÒ»¸öÌØÐÔʵÏÖMySQL²éѯ½á¹ûµÄ·ÖÒ³ÏÔʾ

ÔÚmysqlÖÐÀûÓÃselectÓï¾äµÄÒ»¸öÌØÐԾͿÉÒԺܷ½±ãµØʵÏÖ²éѯ½á¹ûµÄ·ÖÒ³£¬selectÓï¾äµÄÓï·¨£º
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [HIGH_PRIORITY]
[DISTINCT | DISTINCTROW | ALL]
select_expression,...
[INTO OUTFILE 'file_name'&nb ......

mysql ´´½¨Óû§·½·¨

ÃüÁʽµÄ.×¢ÒâÿÐкó±ß¶¼¸ú¸ö £» ±íʾһ¸öÃüÁîÓï¾ä½áÊø.
¸ñʽ£ºgrant select on Êý¾Ý¿â.* to
Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
Àý1¡¢Ôö¼ÓÒ»¸öÓû§test1ÃÜÂëΪabc£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔ
rootÓû§Á¬ÈëMYSQL
£¬
È»ºó¼üÈëÒÔÏÂÃüÁ
gr ......

MysqlÍü¼ÇrootÃÜÂëµÄ½â¾ö°ì·¨

ÔÚwindowsÏ£º
´ò¿ªÃüÁîÐд°¿Ú£¬Í£Ö¹mysql·þÎñ(»òÕßÔÚÈÎÎñ¹ÜÀíÆ÷Àï½áÊøµômysqld-nt.exe½ø³Ì)£º        Net stop mysql
Æô¶¯mysql£¬Ò»°ãµ½mysqlµÄ°²×°Â·¾¶£¬ÕÒµ½ mysqld-nt.exe
Ö´ÐУºmysqld-nt --skip-grant-tables
ÁíÍâ´ò¿ªÒ»¸öÃüÁîÐд°¿Ú£¬Ö´ÐÐmysql
use mysql
update us ......

ubuntu mysqlµÄ°²×°

sudo apt-get install mysql-server
Õâ¸öÓ¦¸ÃºÜ¼òµ¥ÁË£¬¶øÇÒÎÒ¾õµÃ´ó¼ÒÔÚ°²×°·½ÃæҲûʲô̫´óÎÊÌ⣬ËùÒÔÒ²¾Í²»¶à˵ÁË£¬ÏÂÃæÎÒÃÇÀ´½²½²ÅäÖá£
ÅäÖÃMySQL
×¢Ò⣬ÔÚUbuntuÏÂMySQLȱʡÊÇÖ»ÔÊÐí±¾µØ·ÃÎʵģ¬Èç¹ûÄãÒªÆäËû»úÆ÷Ò²Äܹ»·ÃÎʵĻ°£¬ÄÇôÐèÒª¸Ä±ä/etc/mysql/my.cnfÅäÖÃÎļþÁË£¡ÏÂÃæÎÒÃÇÒ»²½²½µØÀ´£º
ĬÈϵÄMySQL°²× ......

MysqlÎÊÌâ»ã×Ü

1£¬Mysql²åÈë¶þ½øÖÆ´ó¶ÔÏó³öÏÖÒì³££¬²åÈë¶þ½øÖƳöÏÖÒì³££¬Ôõô½â¾öcom.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
½â¾ö°ì·¨£ºurl=url=+"?useUnicode=true& ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ