Reputation: 15215
I have a small mariadb SQL initialization script that starts like this:
drop user if exists 'uslmonitor';
drop database if exists uslmonitordb;
create database uslmonitordb;
This fails with this error:
ERROR 1064 (42000) at line 1: 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 'if exists 'uslmonitor'' at line 1
I checked the version of mysql/mariadb on the box, and it says this:
mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1
Update:
Ok, I've upgraded my MariaDB to "10.1.21-MariaDB-1~jessie" (I love Docker), and my init script excerpt is now this:
drop user if exists 'uslmonitor';
drop database if exists uslmonitordb;
flush privileges;
create database uslmonitordb;
create user 'uslmonitor'@localhost identified by 'uslmonitor';
This is failing with:
ERROR 1396 (HY000) at line 7: Operation CREATE USER failed for 'uslmonitor'@'localhost'
Upvotes: 0
Views: 1319
Reputation: 108651
This is one of those cases where reading the error message gives the answer.
That didn't come in until version 5.7.8.
Upvotes: 1