Re: Mystery error in GRANT statement

Richard <[email protected]>
Newsgroups gmane.comp.db.mysql.general
Message-ID <[email protected]>

> Date: Monday, October 03, 2016 18:39:22 -0700
> From: James Moe <[email protected]>
>
> opensuse v42.1
> linux 4.1.31-30-default x86_64
> 10.0.26-MariaDB
> 
> I have a database named "sma-v4-01". The GRANT statement does not
> like that database name:
> 
> MariaDB [sma-v4-01]> GRANT ALL ON 'sma-v4-01'.* TO
> 'xxxxxxxx'@'sma-station14l' IDENTIFIED BY 'xxxxxxxxxxxxxx';
> 
> ERROR 1064 (42000): 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 ''sma-v4-01'.* TO 'xxxxxxxxx'@'sma-station14l'
> IDENTIFIED BY 'xxxxxxxxxxxxxx'' at line 1
> 
> If I replace 'sma-v4-01' with 'sma_joomla', the statement is
> accepted.
> 
> What is wrong with 'sma-v4-01'?


The "dash" (-) isn't really a permissible table name character. If
you want/need to use it I believe you need to use the "backtick" to
quote the name [unless you set "ansi_quotes" in which case you can
use the double quote character].



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.