突然想到这个方法,果然已经有人实现了。

有这个脚本也能看出来,数据表的很多信息都保存在INFORMATION_SCHEMA.TABLES表里,还有数据表注释的重要性!


 */

//配置数据库
$dbserver   = "localhost";
$dbusername = "root";
$dbpassword = "root";
$database   = 'mydb';
//其他配置
$title = '系统数据字典';

$mysql_conn = @mysql_connect("$dbserver", "$dbusername", "$dbpassword") or die("Mysql connect is error.");
mysql_select_db($database, $mysql_conn);
mysql_query('SET NAMES utf8', $mysql_conn);
$table_result = mysql_query('show tables', $mysql_conn);
//取得所有的表名
while ($row = mysql_fetch_array($table_result)) {
    $tables[]['TABLE_NAME'] = $row[0];
}

//循环取得所有表的备注
foreach ($tables AS $k=>$v) {
    $sql  = 'SELECT * FROM ';
    $sql .= 'INFORMATION_SCHEMA.TABLES ';
    $sql .= 'WHERE ';
    $sql .= "table_name = '{$v['TABLE_NAME']}'  AND table_schema = '{$database}'";
    $table_result = mysql_query($sql, $mysql_conn);
    while ($t = mysql_fetch_array($table_result) ) {
        $tables[$k]['TABLE_COMMENT'] = $t['TABLE_COMMENT'];
    }

    $sql  = 'SELECT * FROM ';
    $sql .= 'INFORMATION_SCHEMA.COLUMNS ';
    $sql .= 'WHERE ';
    $sql .= "table_name = '{$v['TABLE_NAME']}' AND table_schema = '{$database}'";

    $fields = array();
    $field_result = mysql_query($sql, $mysql_conn);
    while ($t = mysql_fetch_array($field_result) ) {
        $fields[] = $t;
    }
    $tables[$k]['COLUMN'] = $fields;
}
mysql_close($mysql_conn);


$html = '';
//循环所有表
foreach ($tables AS $k=>$v) {
    $html .= '

'. $v['TABLE_COMMENT'] . ' 

'; $html .= ''; $html .= ''; $html .= ''; $html .= ''; foreach ($v['COLUMN'] AS $f) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= '
' . $v['TABLE_NAME'] . '
字段名数据类型默认值 允许非空 自动递增备注
' . $f['COLUMN_NAME'] . '' . $f['COLUMN_TYPE'] . ' ' . $f['COLUMN_DEFAULT'] . ' ' . $f['IS_NULLABLE'] . '' . ($f['EXTRA']=='auto_increment'?'是':' ') . ' ' . $f['COLUMN_COMMENT'] . '

'; } //输出 echo ' ' . $title . ' '; echo '

' . $title . '

'; echo $html; echo '';

修改一下用户名密码即可,之后打印成PDF即可分发给团队成员使用了。

转自http://www.cnblogs.com/zemliu/archive/2012/06/04/2533555.html

删除自带web、数据库、php

yum remove httpd* php* mysql-server mysql* php-mysql -y

删除不需要的程序

yum remove Deployment_Guide-en-US finger cups-libs cups ypbind bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils sendmail* samba* talk-server finger-server bind* xinetd nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools -y
yum groupremove "Mail Server" "Games and Entertainment" "X Window System" "X Software Development" "Development Libraries" "Dialup Networking Support" "Games and Entertainment" "Sound and Video" "Graphics" "Editors" "Text-based Internet" "GNOME Desktop Environment" "GNOME Software Development" -y
yum -y groupremove "FTP Server" "PostgreSQL Database client" "PostgreSQL Database server" "MySQL Database server" "MySQL Database client" "Web Server" "Office Suite and Productivity" "E-mail server" "Ruby Support" "Printing client"

关闭selinux

setenforce 0
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config

对系统进行一些优化

sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab
init q
[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="[e[37;40m][[e[32;40m]u[e[37;40m]@h [e[35;40m]W[e[0m]]\$ "' >> ~/.bashrc
sed -i 's/^HISTSIZE=.*$/HISTSIZE=10/' /etc/profile
[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=$(history 1 | { read x y; echo $y; });user=$(whoami); echo $(date "+%Y-%m-%d %H:%M:%S"):$user:`pwd`/:$msg ---- $(who am i); } >> /tmp/`hostname`.`whoami`.history-timestamp'" >> ~/.bashrc
[ -z "`cat /etc/security/limits.conf | grep 'nproc 65535'`" ] && cat >> /etc/security/limits.conf <> /etc/rc.local
[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@^127.0.0.1(.*)@127.0.0.1   `hostname` 1@" /etc/hosts
[ -z "`cat /etc/pam.d/system-auth | grep 'pam_tally2.so'`" ] && sed -i '4a auth        required      pam_tally2.so deny=5 unlock_time=180' /etc/pam.d/system-auth

输入vi自动打开vim

[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@alias mv=(.*)@alias mv=1nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc

升级系统

yum -y update
yum clean all

美化命令行,其实在之前优化那里就美化了,这里只是让它生效而已

. /etc/profile
. ~/.bashrc

删除不需要的服务,这里自行考虑,反正我是只保留几个的~

service modules_dep stop
chkconfig modules_dep off
chkconfig --del modules_dep
service netconsole stop
chkconfig netconsole off
chkconfig --del netconsole
service netfs stop
chkconfig netfs off
chkconfig --del netfs
service nscd stop
chkconfig nscd off
chkconfig --del nscd
service quota_nld stop
chkconfig quota_nld off
chkconfig --del quota_nld
service rdisc stop
chkconfig rdisc off
chkconfig --del rdisc
service restorecon stopd
chkconfig restorecond off
chkconfig --del restorecond
service saslauthd stop
chkconfig saslauthd off
chkconfig --del saslauthd
service snmpd stop
chkconfig snmpd off
chkconfig --del snmpd
service snmptrapd stop
chkconfig snmptrapd off
chkconfig --del snmptrapd
service gpm stop
chkconfig gpm off
chkconfig --del gpm
service iscsi stop
chkconfig iscsi off
chkconfig --del iscsi
service iscsid stop
chkconfig iscsid off
chkconfig --del iscsid
service lm_sensors stop
chkconfig lm_sensors off
chkconfig --del lm_sensors
service lvm2-monitor stop
chkconfig lvm2-monitor off
chkconfig --del lvm2-monitor
service mcstrans stop
chkconfig mcstrans off
chkconfig --del mcstrans
service messagebus stop
chkconfig messagebus off
chkconfig --del messagebus
service multipathd stop
chkconfig multipathd off
chkconfig --del multipathd
service netconsole stop
chkconfig netconsole off
chkconfig --del netconsole
service netfs stop
chkconfig netfs off
chkconfig --del netfs
service netplugd stop
chkconfig netplugd off
chkconfig --del netplugd
service nscd stop
chkconfig nscd off
chkconfig --del nscd
service rawdevices stop
chkconfig rawdevices off
chkconfig --del rawdevices
service rdisc stop
chkconfig rdisc off
chkconfig --del rdisc
service restorecond stop
chkconfig restorecond off
chkconfig --del restorecond
service ntpd stop
chkconfig ntpd off
chkconfig --del ntpd
service ip6tables stop
chkconfig ip6tables off
chkconfig --del ip6tables
service ntpdate stop
chkconfig ntpdate off
chkconfig --del ntpdate
service portreserve stop
chkconfig portreserve off
chkconfig --del portreserve
service udev-post stop
chkconfig udev-post off
chkconfig --del udev-post
service exim stop
chkconfig exim off
chkconfig --del exim

转自http://shuang.ca/centos-optimizer/

普通用户篇

Adblock大家族

URL:

Adblock Plus

AdBlock

Adblock Pro

这几个货名气太大,赶紧安装,远离广告

强制雅黑字体

URL:强制雅黑字体

win7下还是用雅黑吧。。。。其他系统随意

OneTab

URL:OneTab

标签神器,我就用这个导出当前所有标签的URL

Proxy SwitchySharp

URL:Proxy SwitchySharp

这个就不多说了,翻{防屏蔽}墙神器

Tampermonkey

URL:Tampermonkey

油猴脚本,允许你在网页中执行任何js

微博是个好图床

URL:微博是个好图床

图片外链神器么,趁着Sina还没有封,抓紧用吧

微博急简

URL:微博急简

新浪微博的官网实在恶心,要学会做减法

慧慧购物助手

URL:慧慧购物助手

购物必备,海淘也给力!

妈妈再也不用担心我的macbook发烫了计划2.0Beta

URL:妈妈再也不用担心我的macbook发烫了计划2.0Beta

我承认这个插件在气势上已经赢了,优酷土豆去广告

开发者篇

POSTMAN

URL:POSTMAN

chrome下测试接口神器

User-Agent Switcher

URL:User-Agent Switcher

修改浏览器代理,调试app或者mobile页,还可以去广告。

NoFollow

URL:NoFollow

seo专用,给网页中no follow的链接高亮出来

SEO in China

URL:SEO in China

快捷查询网站的SEO信息

之前单位用的kangle服务器,便于快速搭建网站。

但是现在不想用了,如何删除呢?

其实很简单:

停止服务

service kangle stop

删除服务启动项

chkconfig kangle off

删除服务

chkconfig --del kangle

删除残留文件

rm -rf  /vhs
rm -f /etc/init.d/kangle

现在重启看看,是不是已经删除的很干净了!

##ps.这个删除流程也可以针对其他服务使用!##

顺便提一下

删除Apache可以用rpm -qa|grep apache|xargs rpm -e,一次删除所有与Apache有关的包

在Linux上使用sysstat

搜索iostat命令后才发现如此强大的系统监控工具!

安装

centos

yum install sysstat -y

Ubuntu

apt-get install sysstat

使用

  • iostat 工具提供CPU使用率及硬盘吞吐效率的数据;
  • mpstat 工具提供单个处理器或多个处理器相关数据;
  • sar 工具负责收集、报告并存储系统活跃的信息;
  • sa1 工具负责收集并存储每天系统动态信息到一个二进制的文件中。它是通过计划任务工具cron来运行,是为sadc所设计的程序前端程序;
  • sa2 工具负责把每天的系统活跃性息写入总结性的报告中。它是为sar所设计的前端 ,要通过cron来调用
  • sadc 是系统动态数据收集工具,收集的数据被写一个二进制的文件中,它被用作sar工具的后端;
  • sadf 显示被sar通过多种格式收集的数据;

iostat

➜ /bin iostat --help 用法: iostat [ 选项 ] [ <时间间隔> [ <次数> ] ] Options are: [ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] [ -j { ID | LABEL | PATH | UUID | ... } [ [...] | ALL ] ] [ [...] | ALL ] [ -p [ [,...] | ALL ] ]

参数说明: -c 输出CPU统计信息。不能与-d参数同时使用。 -d 输出设备和分区的I/O统计信息。不能与-c参数同时使用。(默认的参数是-d) -k 用“kbytes/秒”代替“块/秒”显示统计信息。在内核2.4以及新版中才有效。 -m 用“mbytes/秒”代替“块/秒”显示统计信息。在内核2.4以及新版中才有效。 -t 显示NFS目录统计信息。在内核2.6.17以及新版中才有效。 -V 显示版本号并退出。 -x 显示扩展统计信息。不能与参数-p同时使用。并且需要在内核2.5以上才能使用,因为它需要/proc/diskstats 或者 加载sysfs获取统计信息。 -n 显示NFS目录统计信息。 -h 可读性更好的NFS目录统计信息(经测试,在我的系统上跟-t,-p参数显示没什么差别,但-p参数没法与-x参数同时使用) -p 显示系统使用的块设备和它们的分区统计信息。不能与参数-x同时使用。如果命令中指定了设备名称,显示设备和它的所有分区的统计。如果使用了关键字ALL,将显示系统所有块设备和分区统计信息,即使它们没有被使用。只有在内核2.5或更新版本中有效。 interval 刷新时间间隔 count 刷新次数

实例

# 每隔2秒查询一次CPU及硬盘
iostat 2

# 每隔2秒查询一次共查询10次
iostat -c 2 4

sysstat是个很不错的系统监控软件,有兴趣的同学可以好好研究一下!