一些常用的命令长时间不接触,可能遗忘,记于此,备忘。
mysql篇:
mysqladmin -u root -p oldpassword newpasswd
REPLACE INTO mysql.user (Host,User,Password) VALUES(\'%\',\'system\',PASSWORD(\'manager\'));
(FLUSH PRIVILEGES)
GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456" WITH GRANT OPTION;
(备注:某次总是提示权限不够,原来要在localhost后加上.localdomain)
show create table sms_report;
select * from table into outfile '/tmp/outdata.txt' fields terminated by ',';
mysqlimport -i --columns=userid,mobile,servicecataid,t --fields-terminated-by=, sms /tmp/tablename.txt --local
如果一个表中有自增字段,使用TRUNCATE TABLE和没有WHERE子句的DELETE删除所有记录后,这个自增字段将起始值恢复成1.如果你不想这样做的话,可以在DELETE语句中加上永真的WHERE,如WHERE 1或WHERE true。
replace into province_seg select * from province_seg_tmp;
Oracle篇: