GolfScript, 25 (24) bytes
!10 6?,2>{.(@*.)@%!},n*\;
If the output format specified in the edited question is disregarded, one byte can be saved:
!10 6?,2>{.(@*.)@%!},`\;
This will print the primes as an array (like many other solutions do) rather than one per line.
How it works
The general idea is to use Wilson's theorem, which states that n > 1 is prime if and only if
! # Push the logical NOT of the empty string (1). This is an accumulator.
10 6? # Push 10**6 = 1,000,000.
,2> # Push [ 2 3 4 … 999,999 ].
{ # For each “N” in this array:
.( # Push “N - 1”.
@ # Rotate the accumulator on top of the stack.
* # Multiply it with “N - 1”. The accumulator now hold “(N - 1)!”.
.) # Push “(N - 1)! + 1”
@ # Rotate “N” on top of the stack.
%! # Push the logical NOT of “((N - 1)! + 1) % N”.
}, # Collect all “N” for which “((N - 1)! + 1) % N == 0” in an array.
n* # Join that array by LF.
\; # Discard the accumulator.
Benchmarks
Faster than trial division, but slower than the sieve of Eratosthenes. See my other answermy other answer.