码迷,mamicode.com
首页 > 数据库 > 详细

L004-oldboy-mysql-dba-lesson04

时间:2016-07-07 19:13:20      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:


技术分享



L004-oldboy-mysql-dba-lesson04

 

 

 

 

技术分享

 

技术分享

 

 

 技术分享

技术分享

技术分享

 

技术分享

技术分享

 

 

技术分享

技术分享

技术分享

 

 

技术分享

技术分享

 

 

 

 

技术分享

技术分享

技术分享

 

 

技术分享

技术分享

 

技术分享

 

技术分享

 

技术分享

 

 

 [root@web01 mysql]# mysql -uroot -ptestpassword -S /tmp/mysql.sock

mysql> select inet_aton(‘192.168.1.200‘);

+----------------------------+

| inet_aton(‘192.168.1.200‘) |

+----------------------------+

|                 3232235976 |

+----------------------------+

1 row in set (0.00 sec)

 

mysql> select inet_aton(‘192.168.1.200‘);

+----------------------------+

| inet_aton(‘192.168.1.200‘) |

+----------------------------+

|                 3232235976 |

+----------------------------+

1 row in set (0.00 sec)

 

mysql> create database mydb;

use mydb;create table ip(ip int);

insert ip values(inet_aton(‘192.168.1.200‘));

mysql> insert ip values(inet_aton(‘192.100.2.22‘));

insert ip values(inet_aton(‘172.16.32.15‘));

insert ip values(inet_aton(‘200.100.2.22‘));

insert ip values(inet_aton(‘200.100.2.100‘));

insert ip values(inet_aton(‘200.100.3.150‘));

 

mysql> select * from ip;

+------------+

| ip         |

+------------+

| 2147483647 |

| 2147483647 |

| 2147483647 |

| 2147483647 |

| 2147483647 |

| 2147483647 |

+------------+

6 rows in set (0.00 sec)

 

 

 

 

技术分享

 

 

 

 

技术分享

 

 技术分享

 

mysql> create databases mydb;

use mydb;

 

create table ip_info(

id int unsigned not null auto_increment,

userid int unsigned not null,

username varchar(100) default ‘‘,

ip int unsigned not null,

ctime timestamp default current_timestamp on update current_timestamp,

primary key(id),

index username(username),

index userid(userid),

index ip(ip)

);

 

show create table ip_info;

 

 

insert into ip_info(userid,username,ip) values(11,‘aa‘,inet_aton(‘192.168.1.10‘));

select * from ip_info;

 

技术分享

 

 

技术分享

 

 

技术分享

 

 

 

技术分享

 

技术分享

技术分享

 

1.记录慢查询里面的有三种语句,除了这个还可能是没有使用上索引,以及DML操作语句。
2.
此变量是动态变量,可以在线设置,设置要是基于session的话,可能会导致不生效,设置为global的话,如果连接不断开也会出现不马上生效的情况。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 









附件列表

     

    L004-oldboy-mysql-dba-lesson04

    标签:

    原文地址:http://www.cnblogs.com/bolinzhihua/p/5650782.html

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    登录后才能评论!
    © 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
    迷上了代码!