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

Mysql Explain Ïê½â

Ò».Óï·¨
explain < table_name >
ÀýÈç: explain select * from t3 where id=3952602;
¶þ.explainÊä³ö½âÊÍ
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type  | possible_keys     | key     | key_len | ref   | rows | Extra |
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
1.id
  ÎÒµÄÀí½âÊÇSQLÖ´ÐеÄ˳ÀûµÄ±êʶ,SQL´Ó´óµ½Ð¡µÄÖ´ÐÐ.
ÀýÈç:
mysql> explain select * from (select * from ( select * from t3 where id=3952602) a) b;
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
| id | select_type | table      | type   | possible_keys     | key     | key_len | ref  | rows | Extra |
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
|  1 | PRIMARY     | <derived2> | system | NULL              | NULL    | NULL    | NULL |    1 |       |
|  2 | DERIVED     | <derived3> | system | NULL              | NULL    | NULL    | NULL |    1 |       |
|  3 | DERIVED     | t3         | const  | PRIMARY,idx_t3_id | PRIMARY | 4       |      |    1 |       |
+----+-------------+------------+--------+-------------------+---------+---------+------+------+-------+
ºÜÏÔÈ»ÕâÌõSQLÊÇ´ÓÀïÏòÍâµÄÖ´ÐÐ,¾ÍÊÇ´Óid=3 ÏòÉÏÖ´ÐÐ.
2. select_type
¾ÍÊÇselectÀàÐÍ,¿ÉÒÔÓÐÒÔϼ¸ÖÖ
(1) SIMPLE
¼òµ¥SELECT(²»Ê¹ÓÃ


Ïà¹ØÎĵµ£º

linuxÏÂmysqlµÄʹÓÃ


Æô¶¯mysql:  /etc/rc.d/init.d/mysql start
ÐÞ¸ÄÃÜÂë: ¸ñʽ£ºmysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
ʹÓÃÃÜÂëµÇ¼:  mysql -u root -p
ÏÔʾÊý¾Ý¿â:  show databases;
Ñ¡ÔñÊý¾Ý¿â:  use Êý¾Ý¿âÃû;
ÏÔʾ±í:  show tables;
ÏÔʾ±í½á¹¹:  descibe ±íÃû;
Ô¶³ÌµÇ¼mysqlÐèÒª¿ªÆôÈ ......

¸ü¸ÄMySqlÊý¾Ý¿âµÄĬÈϱàÂë¸ñʽ

Ò»¡¢ÉèÖÃÊý¾Ý¿â±àÂë
°²×°mysqlʱ¿ÉÑ¡Ôñ±àÂ룬Èç¹ûÒѾ­°²×°¹ý£¬¿ÉÒÔ¸ü¸ÄÎļþmy.ini(´ËÎļþÔÚmysqlµÄ°²×°Ä¿Â¼ÏÂ)ÖеÄÅäÖÆÒԴﵽĿµÄ£»´ò¿ªÎļþÕÒµ½Á½´¦£º
[client]
port=3306
[mysql]
default-character-set=gb2312
# The default character set that will be used when a new
schema or table is
# created and
n ......

ÐÞ¸ÄMySQLĬÈÏÃÜÂëµÄ¾ßÌå²½Ö裨ת£©

access denied for user 'root'@'localhost' (using password: YES);
½ñÌìÓÃmysqlµÄʱºò£¬µÇ¼µÄʱºò³öÏÖÁËÕâ¾ä£¬²»ÖªµÀÊÇʲôÒâ˼£¬ÒòΪÎÒµÄmysqlÊÇ×°centosµÄʱºòÒ»Æð×°µÄ£¬ÃÜÂëÎÒ¾ÍÊäÈëÎÒµÄÕÊ»§ÃÜÂ룬½á¹û³öÏÖÁËÉÏÃæÄǾ䣻°Ù¶ÈÁËһϣ¬»¹Õæ²»ÉÙÈ˳öÏÖÁËÕâ¸öÎÊÌâ¡£¡£×îºóÎÒÕÒµ½ÁË·½·¨£»
[root@localhost home]# mysql - ......

UbuntuÖÐ Mysql Ô¶³ÌµÇ¼µÄ½â¾ö·½·¨

mysql>use mysql;
mysql>update user set host='%' where user='root';
ÖØÆôMysql
sudo /etc/init.d/mysql restart
[sudo] password for wangzw:
*Stopping MySQL database server mysqld                   & ......

MYSQLÍü¼ÇROOTÃÜÂëºó£¿

 
 MYSQLÍü¼ÇROOTÃÜÂëºó£¿
 
ÐÞ¸ÄMySQLµÄµÇ¼ÉèÖãº
1.È¡ÏûȨÏÞ¹ÜÀí
±à¼­ /mysql5.1/my.ini
ÔÚ[mysqld]µÄ¶ÎÖмÓÉÏÒ»¾ä£ºskip-grant-tables
ÀýÈ磺
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
Ä¿µÄÊÇΪÁË£º
Ìø¹ýMySQLµÄ·ÃÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ