快乐的瞬间
幸福的瞬间
心碎的瞬间
无耐的瞬间
快乐的瞬间
幸福的瞬间
心碎的瞬间
无耐的瞬间
最早接触到的show,如show databases; show tables; 其实show还有更多的用法。
显示mysql中所有数据库的名称
show databases;
显示当前数据库中所有表的名称
show tables 或 show tables from database_name;
显示正在执行的查询。大多数用户可以查看他们自己的进程,但是如果他们拥有process权限,就可以查看所有人的进程,包括密码。
show processlist;
或
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST
显示当前使用或者指定的database中的每个表的信息。信息包括表类型和表的最新更新时间
show table status;
显示表中列名称,或者说是表的结构
show columns from table_name from database_name; 或 show columns from database_name.table_name;
显示一个用户的权限,显示结果类似于grant 命令
show grants for user_name@localhost;
显示表的索引
show index from table_name;
显示一些系统特定资源的信息,例如,正在运行的线程数量,mysql运行uptime(秒)
show status;
显示系统变量的名称和值
show variables;
查看默认存储引擎
SHOW VARIABLES LIKE 'storage_engine';
查看该数据库系统支持的存储引擎的类型:
SHOW ENGINES;
显示服务器所支持的不同权限
show privileges;
显示create database 语句是否能够创建指定的数据库
show create database database_name;
显示create database 语句是否能够创建指定的数据库
show create table table_name;
显示安装以后可用的存储引擎和默认引擎
show engines;
显示innoDB存储引擎的状态
show innodb status;
显示最后一个执行的语句所产生的错误、警告和通知
show warnings;
只显示最后一个执行语句所产生的错误
show errors;
查看时区
show variables like 'time_zone';
有的客户想买vps使用vnc,不知道这样做的意义在哪,不过安装一下练练手也可以。这里使用的版本是centos6.2 x64.
参考:https://www.grumpyland.com/blog/72/tutorial-installing-vnc-for-centos-6-vps/
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
yum groupinstall -y Desktop Fonts Xfce
yum install -y tigervnc-server
操作vnc不要用root,创建用户jpuyy
useradd jpuyy passwd jpuyy
接下来使用jpuyy来操作
#su -l jpuyy
$vncpasswd
输入两次密码之后,在~/.vnc/下有一个文件passwd ,说明创建vnc用户成功。
接下来ctrl+D,使用root操作
vi /etc/sysconfig/vncservers
写入如下内容,意思是第一个用户为jpuyy,分辨率为1024×786
VNCSERVERS="1:jpuyy" VNCSERVERARGS[1]="-geometry 1024x786"
启动vncserver
service vncserver start
可设置开机启动
/sbin/chkconfig vncserver on
为了更佳的体验效果,安装firefox,首先安装rpmforge源
rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm yum install -y firefox yum install -y flash-plugin
这时,使用vnc客户端,打开ip:5901,密码为执行$vncpasswd时创建的密码。即可使用vnc远程进行管理。
前段时间有一客户要把之前的asp网站搬家,2003跑IIS,asp企业站有点过时的东西,现在也只有大学的课上还会搞这个吧?
配好之后打开index.asp却提示404错误。
搜索后发现IIS已经默认不支持ASP。开启方法:
IIS-WEB服务扩展 -> Active Server Pages -> 允许
用CentOS也有一段时间了,整理一下rpm命令的用法
安装.rpm的文件,-i代表–install,-v代表–verbose,-h代表–hash 以#显示安装进度
rpm -ivh package.rpm
升级软件包
rpm -U packupdate.rpm
查看已经安装的软件
列出已经安装的全部软件包,查具体包可接 | grep 来筛选,或使用通配符
rpm -qa
例如:
# rpm -qa httpd* httpd-tools-2.2.15-15.el6.centos.1.x86_64 httpd-2.2.15-15.el6.centos.1.x86_64 或 # rpm -qa | grep http httpd-tools-2.2.15-15.el6.centos.1.x86_64 httpd-2.2.15-15.el6.centos.1.x86_64
找到某文件属于哪个软件包,使用
rpm -qf filename
例如:
rpm -qf /etc/httpd/conf/httpd.conf
执行结果: httpd-2.2.15-15.el6.centos.1.x86_64
-qi 查看已经安装的软件包的功能,
rpm -qi packagename
-pqi 查看没有安装的.rpm包的详细信息
[root@localhost ~]# rpm -pqi epel-release-6-8.noarch.rpm Name : epel-release Relocations: (not relocatable) Version : 6 Vendor: Fedora Project Release : 8 Build Date: Mon 05 Nov 2012 11:54:41 AM CST Install Date: (not installed) Build Host: buildvm-05.phx2.fedoraproject.org Group : System Environment/Base Source RPM: epel-release-6-8.src.rpm Size : 22169 License: GPLv2 Signature : RSA/8, Mon 05 Nov 2012 11:29:49 PM CST, Key ID 3b49df2a0608b895 Packager : Fedora Project URL : http://dl.fedoraproject.org/pub/epel/ Summary : Extra Packages for Enterprise Linux repository configuration Description : This package contains the Extra Packages for Enterprise Linux (EPEL) repository GPG key as well as configuration for yum and up2date.
如查看wget的功能说明
rpm -qi wget
删除已经安装的软件包
rpm -e packagename
查看已经安装好的软件包都包含哪些文件
rpm -ql iptables
查看某个 rpm 包包含有哪些文件
rpm -qlp package.rpm
对于 yum 源里没有安装在本机的 rpm 包查看要装哪些文件,可以这样查(前提要安装好yum-utils)
repoquery -q -l --plugins memcached
参考:http://www.cyberciti.biz/faq/howto-list-find-files-in-rpm-package/
大前提:
因涉及到发邮件,debian下需安装exim4并可对外发邮件,centos则需安装mailx,sendmail。
方案1,对所有用户生效,创建文件
vim /etc/ssh/sshrc
加入以下内容
#!/bin/bash [email protected] mail -s "notification:user $USER login from ${SSH_CLIENT%% *}" $yourmail <<EOT the ip information : http://www.123cha.com/ip/?q=${SSH_CLIENT%% *} login date: `date +%Y/%m/%d" "%H:%M:%S` if this is not you , please contact xxx for help. EOT
方案2,不影响他人,只针对自己的账户
vim ~/.bashrc
添加
echo 'ALERT Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" [email protected]