标签:导入 length min 数据导入 inno 执行 user int utf8
假设表结构如下CREATE TABLE sas_sys_app
(user_id
varchar(38) DEFAULT NULL,app_id
int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
SELECT CONCAT(
"*4\r\n",
‘$‘, LENGTH(redis_cmd), ‘\r\n‘,
redis_cmd, ‘\r\n‘,
‘$‘, LENGTH(redis_key), ‘\r\n‘,
redis_key, ‘\r\n‘,
‘$‘, LENGTH(hkey), ‘\r\n‘,
hkey, ‘\r\n‘,
‘$‘, LENGTH(hval), ‘\r\n‘,
hval, ‘\r‘
)
FROM (
SELECT
‘HSET‘ as redis_cmd,
‘hkey‘ AS redis_key,
user_id AS hkey,
app_id AS hval
FROM lumi_saas_access.sas_sys_app where company_id=64
) AS t
mysql -uadmin -h host -p数据库密码 库 --default-character-set=utf8 --skip-column-names --raw < app2redis.sql | redis-cli -h redis-host -p 6379 --pipe
标签:导入 length min 数据导入 inno 执行 user int utf8
原文地址:https://blog.51cto.com/viphyy/2438876