SELECT CONCAT(
"*3\r\n",
'$',LENGTH(redis_cmd),'\r\n',redis_cmd,'\r\n',
'$',LENGTH(redis_key),'\r\n',redis_key,'\r\n',
'$',LENGTH(redis_val),'\r\n',redis_val,'\r'
) FROM (
SELECT 'SET' as redis_cmd,
id as redis_key,
name as redis_val
FROM table_example
) AS table
$ mysql -hlocalhost -uusername -ppassword dbname \
--skip-column-names --raw < data.sql | redis-cli --pipe