mysql
- 连接
mysql -u root -p -h 10.185.177.51 -P 3306 - 查库,用库
show databases;
use database1; - 跨表查询
SELECT c.LINETYPE,a.GUID,a.ADMAREAGUID,a._NAME,a.X,a.Y,c.STOPS FROM pt_stop as a,pt_relation_stop as b,pt_link as c where c.AD_CODE = 320500 and a.GUID = b.GUID and b.LINEGUID = c.GUID into outfile “/tmp/bus_new.txt” FIELDS TERMINATED BY ‘\t’; - 查表
show tables;
select * from t_1 limit 1; - 备份
mysqldump -u gisadmin -pGis0s_4h8Hoop -h 10.146.151.198 -P 3306 xz_busdata > xz_busdata.sql - 清空
truncate table 表名 - 导入本地文件
mysql -u root -p -h 10.185.177.51 -P 3306 –local-infile=1 - 数据导出
mysql dump出数据库(结构和数据)的示例如下:
mysqldump -h ip -u用户名 -pdbpasswd xxx_gis >gis.sql;
mysqldump -h ip -u用户名 -pdbpasswd xxx_busdata >busdata.sql;
redis
- 启动
nohup ./redis-server ../conf/redis-xz.conf & - 连接、认证
redis-cli -h 10.185.177.51 -p 6383 -a hmapdb –raw
-a : auth “xxxxxx”
–raw :显示中文 - 切换库
select 2 - 查key
keys * - 清空
FLUSHALL