摘要: 在MySQL数据库中,创建复合索引的时候,不知道在创建过程中哪个列在前面,哪个列该在后面,用以下方式即可:select count(distinct first_name)/count(*) as first_name_selectivity,count(distinct last_name)/co 阅读全文
posted @ 2016-01-29 17:22 __Yoon 阅读(4740) 评论(0) 推荐(0) 编辑
摘要: 常用的mysql show命令如下:1、show databases; 显示mysql中所有数据库2、show tables [from databases] ; 显示当前数据库中所有的表的名称3、show columns from tables; 显示表中列的名称,于desc table_name 阅读全文
posted @ 2016-01-29 17:22 __Yoon 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 1、进去指定schema 数据库(存放了其他的数据库的信息) mysql> use information_schema;2、查询所有数据的大小 mysql> select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from T 阅读全文
posted @ 2016-01-29 17:21 __Yoon 阅读(2763) 评论(0) 推荐(1) 编辑
摘要: OS: CentOS 6.3DB:5.5.14mysql> show processlist;+----+------+-----------+--------------------+---------+------+-------+------------------+| Id | User | 阅读全文
posted @ 2016-01-29 17:20 __Yoon 阅读(640) 评论(0) 推荐(0) 编辑
摘要: OS:Cent OS 6.3DB:5.5.14如果一台服务器上有100个MySQL数据库实例,此时需要给不同端口的几个数据库添加用户名、密码并授权应用IP,一个个授权没问题,反正累的不是我,哇咔咔。创建add_user.sh#/bin/bash#add user to mysql dbpasspwd 阅读全文
posted @ 2016-01-29 17:20 __Yoon 阅读(2035) 评论(0) 推荐(0) 编辑
摘要: OS: centos 6.3DB:5.5.14mysql> select database();+------------+| database() |+------------+| sakila |+------------+1 row in set (0.00 sec)mysql> delete 阅读全文
posted @ 2016-01-29 17:18 __Yoon 阅读(428) 评论(0) 推荐(0) 编辑
摘要: OS: centos 6.3DB: 5.5.14测试创建yoon测试表,没有主键,没有索引,基础数据内容如下: mysql> select * from yoon;+----+----------+------+| id | name | user |+----+----------+------+ 阅读全文
posted @ 2016-01-29 17:18 __Yoon 阅读(2701) 评论(0) 推荐(0) 编辑
摘要: DB:5.5.14OS:CentOS 6.3安装多实例MySQL数据库,安装完成后默认无密码,一次性给所有实例的root账户创建密码:#!/bin/bash for i in {3361..3363} do /export/servers/mysql/bin/mysql -uroot -S /exp 阅读全文
posted @ 2016-01-29 17:17 __Yoon 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 数据库版本:5.5.14操作系统版本:contos 6.3服务器256G内存,安装90个实例。通过脚本启动90个mysql数据库实例,会有几个实例无法启动,进程启动后直接被杀死。查看mysql日志如下:140729 10:32:34 [ERROR] Can't create thread to ki 阅读全文
posted @ 2016-01-29 17:17 __Yoon 阅读(2011) 评论(0) 推荐(0) 编辑
摘要: 版本:5.5.14OS: ConetOS 6.31、创建recover.sh[root@yoon export]# vi recover.sh #!/bin/bash bakdir=/export/datamysql=/export/servers/mysql/bin/mysqluser=rootp 阅读全文
posted @ 2016-01-29 17:16 __Yoon 阅读(285) 评论(0) 推荐(0) 编辑