MySQL - How do you enter a record with only whitespace " "? I want to enter the record with white-space as a record in MySQL. I had tried to enter it through shell and phpmyadmin, the record enters but when I try to retrieve the record it returns as null. I had also set the column null = no even then returns nothing.

code is below through shell and php:

insert into first_replace(to_replace, with_replace) values(".", " ");
You should use VARCHAR instead of CHAR for data type, if you want to store spaces. Space (whitespace) retention is documented in MySQL online documentation:


  The CHAR and VARCHAR types are similar, but differ in the way they are
  stored and retrieved. They also differ in maximum length and in
  whether trailing spaces are retained.