2
On the server there are some databases with the name modelo-submodelo
(this is the name of the database, created with "-" same).
When I execute a command like:
mysqldump -h"$DBHOST" -u"$DBUSER" -p"$DBPASS" modelo-submodelo --compress=TRUE > $TEMP/$DBTEMPNAME
works normally. However, if I have to create the base again using command line:
mysql -h"$DBHOST" -u"$DBUSER" -p"$DBPASS" -e "create database modelo-submodelo;"
returns the error due to "-":
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near '-submodel' at line 1
How should I mount this command so it doesn’t error and create the database correctly?
Try "create database" template-submodel";"
– Murillo Goulart
Also try with the grave accent,
mysql -h"$DBHOST" -u"$DBUSER" -p"$DBPASS" -e "create database \
submodel model`;"`– lazyFox
@lazyFox worked, inside the script had to put
mysql -h"$DBHOST" -u"$DBUSER" -p"$DBPASS" -e "create database \
model-submodel`"` thank you very much.– h3nr1ke