Single quote (') in MySQL console This is normal MySQL query

mysql&gt; select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)

mysql&gt; 


I notice that when I accidentally put ' in it ... the console seems to stuck there.

mysql&gt; '
    '&gt; 
    '&gt; select database();
    '&gt; 
    '&gt; '


SQL query such as select database(); doesn't work anymore.

The question is why is this happen with '? Is there any explanation for this behavior?
I notice that when I accidentally put ' in it ... the console seems to stuck there 


It's not "stuck" at all.  

It's patiently waiting for you to supply the closing quote for the string (or date) literal that you started when you typed in the opening quote!  It even goes as far as to give you a "hint" that it's doing so - notice the different prompt it offers you, complete with a quote character in it! 

Of course, when you do provide that closing quote, it will complain bitterly because what you've entered doesn't make sense.