Why username and hostname is quoted in MySQL? -
i found in many sources including mysql documentation, statement appears
show grants 'monty'@'localhost';
example taken here. note both monty
, localhost
quoted. tried unquoted version
show grants monty@localhost;
in mysql console, , got same result.
could explain reason why 2 words quoted in docs , tutorials?
that's because mysql user names can contain character, including quotation marks , spaces. example, legal syntax:
mysql> grant on test.* ' \\"\'@*.'@'localhost'; query ok, 0 rows affected (0.00 sec)
if user name contains non-alphanumeric characters dots, spaces or quotation marks, mysql throw error unless enclosed in quotation marks , escaped backslashes necessary.
mysql
No comments:
Post a Comment