The comment made by @Solarflare is on point, i.e. you need to join your relation with another one that has at least 5 rows.
You need to first create a dummy table of 2**N rows with column id
and integer values 1, 2, 3, ... 2**N. The following would, for example, create a table of 2**20 rows (see this):
set @i = 0;
drop TEMPORARY table if exists dummyids;
create TEMPORARY table dummyids
select @i := @i + 1 as id
from (select true union all select true) t0
join (select true union all select true) t1
join (select true union all select true) t2
join (select true union all select true) t3
join (select true union all select true) t4
join (select true union all select true) t5
join (select true union all select true) t6
join (select true union all select true) t7
join (select true union all select true) t8
join (select true union all select true) t9
join (select true union all select true) t10
join (select true union all select true) t11
join (select true union all select true) t12
join (select true union all select true) t13
join (select true union all select true) t14
join (select true union all select true) t15
join (select true union all select true) t16
join (select true union all select true) t17
join (select true union all select true) t18
join (select true union all select true) t19
;
select * from dummyids;
Since you only need 5 rows, let's create a table of 8 rows:
set @i = 0;
drop TEMPORARY table if exists dummyids;
create TEMPORARY table dummyids
select @i := @i + 1 as id
from (select true union all select true) t0
join (select true union all select true) t1
join (select true union all select true) t2
;
select * from dummyids;
Now all you need to do is join your original relation with another relation that has at least 5 rows (which we have conveniently created above):
SELECT 'A' a, @nr:=@nr+1 AS c
FROM (SELECT @nr:=0) r join dummyids
WHERE @nr < 5;
Now I recognize you could have taken the numbers directly from the dummyids
table:
SELECT 'A' a, dummyids.id c
FROM dummyids
WHERE id <= 5
ORDER BY id;
But I wanted to show a technique that could be used when you are using MySql variables in a more complicated way.