易截截图软件、单文件、免安装、纯绿色、仅160KB

Mysql Explain 详解

Mysql Explain 详解
转自ITPUBhttp://www.itpub.net/viewthread.php?tid=1034410&extra=page%3D1%26amp%3Bfilter%3Ddigest&page=1
一.语法
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 |       |
+----+-------------+------------+--------+-------------------+---------+---------+------+------+------


相关文档:

远程连接 MySQL l资料 zz


远程连接mysql资料
远程连接到mysql需要做的:
1、进入mysql,创建一个新用户xuys:
格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";
grant select,update,insert,delete on *.* to xuys@192.168.88.234 identified by "xuys1234";
查看结果,执行:
   use mysql;
 & ......

mysql 一条sql语句update更新两个表

你写过一条sql语句来修改两个表的数据吗?
UPDATE test.table1 t1,test.table2 t2 SET t1.aa='a',t1.bb='b',t2.cc='c',WHERE t1.u_id=t2.u_id AND t1.u_id='1'  ;
table1的u_id和table2的u_id是主外键关系 ......

忘记mysql密码后,重新安装mysql全攻略

 
1. 开始->控制面板->添加或删除程序->卸载mysql
2. 假设之前mysql的安装目录是C:\Program Files\MySQL\MySQL Server 5.1/, 那么这个下面还保留了一些东西,打开my.ini
3. 找到#Path to the database root, 然后按照这个Path找到mysql,删掉
4. 把C:\Program Files\MySQL也删掉
5. 开始->运行 输入r ......

MySQL 数据库常用命令


1、MySQL常用命令
create database name; 创建数据库
use databasename; 选择数据库
drop database name 直接删除数据库,不提醒
show tables; 显示表
describe tablename; 表的详细描述
select 中加上distinct去除重复字段
mysqladmin drop databasename 删除数据库前,有提示。
显示当前mysql版本和当前日期
s ......

再次遭遇linux下mySql中文乱码问题

小结:
首先要找到mySql的配置文件
my.cnf
然后要改对地方
[client]和[mysqld]下同时加上default-character-set=utf8
然后记得需要重启MySql.且保证客户端的连接方式也是utf8.
预祝自己新的一年,吉祥如意,心想事成! ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号