mysql 小记
显示前500个MAC 地址
mysql> select macaddr from networks union select mac from netmap limit 500;
创建一个表
mysql> create table ssid (ssid VARCHAR(50),mac VARCHAR(50));
insert into worker values("mac","user","model","Approver");
update user set host = '192.168.%.%' where user = '用户名' and host='主机名';
delete from Course WHERE c_id = 5 AND c_name = 'computer';
【修改exception表中一个字段】
mysql> alter table exception change COLUMN approved approver VARCHAR(50) ;
把显示的内容输出到文件
# mysql -p -Ne "use ocsweb;select macaddr from networks union select mac from netmap;" > /tmp/rs.txt
【从文件读取到表中】
mysql> load data low_priority infile "/mydata/data/switch.mac" into table switch1119;
tab分隔开的文件,导入到这个表
mysql> load data low_priority infile "/mydata/data/ssid" into table ssid fields terminated by '\t';
【修改远程登录用户】
mysql> select user,host,password from user;
mysql> update user set host = '192.168.%.%' where user = '用户名' and host='主机名';
mysql> flush privileges;
mysql> select user,host,password from user;
[root@hghast001 ~]# iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@hghast001 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@hghast001 ~]# logout
[root@pc0003 glpi_switch_ocs]# mysql -hIP -ppassword -Ne "show databases;"
把MAC字符全转大写,把ssid表中的MAC与 (select macaddr from networks union select mac from netmap )的结果匹配,显示重复的
mysql> select mac from ssid where UPPER(ssid.mac) in (select UPPER(macaddr) from networks union select UPPER(mac) from netmap );
+-------------------+
| mac |
+-------------------+
| 10:6f:3f:29:**:** |
| 60:33:4b:12:**:** |
| 6c:59:40:9f:**:** |
| b8:09:8a:d8:**:** |
| b8:09:8a:d8:**:** |
| b8:bc:1b:c7:**:** |
| d8:a2:5e:92:**:** |
| e8:bd:d1:f6:**:** |
+-------------------+
8 rows in set (0.06 sec)
显示MAC详情
mysql> select * from netmap where mac like "%d8:a2:5e:92:**:**%"\G
*************************** 1. row ***************************
IP: 192.168.**:**
MAC: D8:A2:5E:92:**:**
MASK: 255.255.**:**
NETID: 192.168.**:**
DATE: 2015-10-12 16:38:20
NAME: CMCC-**:**
1 row in set (0.01 sec)
更改ocs用户密码
mysql> use ocsweb;
Database changed
mysql> select * from operators;
+--------+-----------+----------+----------------------------------+
| ID | FIRSTNAME | LASTNAME | PASSWD |
+--------+-----------+----------+----------------------------------+
| a***** | a***** | admin | ffa904dae9b672b7924************* |
| ch*****| ch***** | ch***** | 92c32fae70e45033b38************* |
| ez*****| Er***** | Zh***** | ffa904dae9b672b7924************* |
+--------+-----------+----------+----------------------------------+
3 rows in set (0.02 sec)
mysql> update operators set PASSWD="92c32fae70e45033b38491091e*****" where ID="a*****";mysql 小记 增删改 从文件读取到表中 修改远程登录用户 更改ocs用户密码
原创
©著作权归作者所有:来自51CTO博客作者990487026的原创作品,谢绝转载,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
mysql添加登录用户(设置远程登录用户)
mysql添加登录用户(设置远程登录用户)
java web springboot mysql IP -
更改SVN登录用户
删除掉Documents and Settings\user\Application Data\Subversion\auth\svn.si\
SVN subversion 用户名 svn
















