2018-08-29--基礎不牢[丟人了]
阿新 • • 發佈:2018-08-29
sql的基本操作 端口 信息 gre all 阿裏 程序 slist 基礎 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)
2018-08-29--基礎不牢[丟人了]