I just want to select backslash-period “(.)”.
In the MySQL client when I run
mysql> select '\.';
+----+
| . |
+----+
That is the outcome I want, but when I create a file name reverse.sql contains the same query as following
cat reverse.sql
select '\';
When I run this query in the following way I get:
mysql -h mysqlhost -u admin -p -N mydatabase < reverse.sql
\.
Instead of .
I get \.
.
Because backslash-period is special character bash hinders me I guess, but is there any way to solve this issue and get “.” instead of “\.”?
MySQL version 8.0.37
Thanks!
2
% mysql -N < reverse.sql
\.
% mysql --raw -N < reverse.sql
.
Cf. https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_raw
For nontabular output (such as is produced in batch mode or when the
--batch
or--silent
option is given), special characters are escaped in the output so they can be identified easily. Newline, tab, NUL, and backslash are written asn
,t
,, and
\
. The--raw
option disables this character escaping.