SELECT * FROM table_name ORDER BY rand() LIMIT 5;
mysql> select RAND();
-> 0.5925
mysql> select RAND(20);
-> 0.1811
mysql> select RAND(20);
-> 0.1811
mysql> select RAND();
-> 0.2079
mysql> select RAND();
-> 0.7888
SELECT *
FROM table_name AS r1 JOIN
(SELECT ROUND(RAND() *
(SELECT MAX(id)
FROM table_name)) AS id)
AS r2
WHERE r1.id >= r2.id
ORDER BY r1.id ASC
LIMIT 5;