Syntax Error Reported When GRANT Is Used to Grant All Privileges
Scenario
The grant statement can be used to grant all privileges on a database whose name is in letters. If this statement is used to grant all privileges on a database whose name is in digits, the following error is reported: You have an error in your SOL syntax.
Database name in letters:
grant all PRIVILEGES on aaaaa.* to 'TA01'@'%';
Database name in digits:
grant all PRIVILEGES on 11111.* to 'TA01'@'%';
Possible Causes
This problem is caused by a syntax error. In MySQL, backquotes (`) are introduced to distinguish MySQL keywords from common characters. You can enter a backquote (`) to ensure correct syntax.
Solution
If the database name is in digits, add a backquote (`) before and after the database name.
grant all PRIVILEGES on `11111`.* to 'TA01'@'%';
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot