2017-02-22 146 views
1

我設置一個MySQL數據庫作爲一個權限:我的SQL設置權限

GRANT SELECT ON 'Whats-uav-u-100176'.* to "wvico-zag-u-100787" 

但我得到這個錯誤:

‍‍#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Whats-uav-u-100176'.* to "wvico-zag-u-100787"' at line 1

如何解決這個問題呢?

+0

您的意思是'GRANT ALL'而不是'GRANT SELECT'試試? – zed

+0

不,我不希望這個用戶做任何編輯,只需選擇 –

+0

要查看被授予用戶'SELECT FROM common_schema.sql_show_grants其中user =「應用」 sql_grants;' – zed

回答

0

使用SELECT選項GRANT我認爲你需要指明列列表

GRANT SELECT (column_list) ON 'Whats-uav-u-100176'.* to "wvico-zag-u-100787" 
+0

都能跟得上我的主機發送這是SQL查詢你需要運行:GRANT SELECT,INSERT,UPDATE,DELETE ON'DATABASE'。*到「USERNAME」,但我不希望這個用戶更新等。 –

0
GRANT SELECT ON Whats-uav-u-100176.* TO [email protected]'%' IDENTIFIED BY 'password'; 

如果你想要一個以上的接入。

GRANT SELECT, INSERT, DELETE ON Whats-uav-u-100176.* TO [email protected]'%' IDENTIFIED BY 'password'; 
0

語法正常,但如果SQL_MODE在您的服務器上設置爲ANSI_QUOTES。

ANSI_QUOTES

Treat " as an identifier quote character (like the ` quote character) and not as a string quote character. You can still use ` to quote identifiers with this mode enabled. With ANSI_QUOTES enabled, you cannot use double quotation marks to quote literal strings, because it is interpreted as an identifier.

用單引號

GRANT SELECT ON 'Whats-uav-u-100176'.* to 'wvico-zag-u-100787'