2018-08-29--基础不牢[丢人了]

1,获取阿里云或腾讯云的公网ip

## 方法1
curl -s ipecho.net/plain

## 方法2
curl rl myip.ipip.net

2,SSH登录Linux

## 默认端口22
ssh 192.168.204.52

## 如果修改了端口为30022,则需要用参数 -p
ssh 192.168.204.52 -p30022

3,MySQL的基本操作

## 登录MySQL,默认端口3306,并且没有密码,可以使mysql命令直接登录
mysql

## 如果端口是23306呢?
mysql -uroot -h127.0.0.1 -P3306 -p

## 查询mysql.user中的用户
select host,user,password from mysql.user;

## 查询权限
show grants for [email protected];

## 用户授权
grant select on zabbix.* to zabbix_user@'192.168.204.%' identified by 'pass123';
flush privileges;

grant select on testdb.* to common_user@'%'  
grant insert on testdb.* to common_user@'%'  
grant update on testdb.* to common_user@'%'  
grant delete on testdb.* to common_user@'%'

## 查询新用户权限
show grants for zabbix_user@'192.168.204.%';

## 撤销授权 revoke
revoke all on *.* from dba@localhost;

## 查询用户信息
select host,user,password from mysql.user where user='zabbix_user';

## 查看当前的mysql 进程
show full processlist;

4,Linux后台执行程序

nohup python mytest.py &

## 查看进程
ps -ef |grep mytest

5,Python获取某些日期

import datetime 
today = datetime.date.today()
i = 8
while i >= 2:
    day1 = today - datetime.timedelta(days=i)
    day2 = today - datetime.timedelta(days=(i-1))
    i -= 1
    print (day1,day2)

猜你喜欢

转载自blog.51cto.com/11114389/2166197