I'm trying to script the creation of a database with tables. I'm encountering errors but the error messages are not helpful to me because I'm a novice.
I'm finding the mysql tool is providing mostly useless error messages. It is telling me there's an error but it is not telling me what the error is. mysql -v just echos the command, and does not detail the actual error.
My question is, how do I get useful error information from mysql command?
Here is an example of the script:
# Whitelist table mysql -v -u"${MARIADB_USER}" -p"${MARIADB_PASS}" -e ' USE '"${MY_DB}"'; CREATE TABLE IF NOT EXISTS '"${MY_WHITE_TABLE}"' ("key" INT PRIMARY KEY NOT NULL AUTO_INCREMENT, "number" VARCHAR(20) CHARACTER SET utf8); ' Here is an example of the error message:
-------------- CREATE TABLE IF NOT EXISTS whitelist ("key" INT PRIMARY KEY NOT NULL AUTO_INCREMENT, "number" VARCHAR(20) CHARACTER SET utf8) -------------- ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the ma nual that corresponds to your MariaDB server version for the right syntax to use near '"key" INT PRIMARY KEY NOT NULL AUTO_INCREMENT, "number" VARCHAR(20) CHARA CTER SE' at line 2 I've tried leaving the column name unquoted, single quoting the column name, and double quoting the column name. At this point I believe the problem lies elsewhere, but I don't know where.