From 48e7d92a377ff7a6a298cb5814305061949f3a20 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro Jato Date: Tue, 28 Sep 2021 19:55:07 +0200 Subject: [PATCH] Fixes user creation in SQL The user creation defined in the SQL files was valid for MySQL 5, but it is no longer supported by MySQL 8+. This commit fixes this error by using a syntaxis compatible with MySQL 8+. --- additional-material/db/xcs-sample-mysql.sql | 3 ++- additional-material/db/xcs-sample-test-mysql.sql | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/additional-material/db/xcs-sample-mysql.sql b/additional-material/db/xcs-sample-mysql.sql index 5a3e468..077de42 100644 --- a/additional-material/db/xcs-sample-mysql.sql +++ b/additional-material/db/xcs-sample-mysql.sql @@ -31,7 +31,8 @@ CREATE TABLE `Pet` ( -- -- User creation -- -GRANT ALL PRIVILEGES ON xcs.* TO xcs@localhost IDENTIFIED BY 'xcs'; +CREATE USER IF NOT EXISTS xcs@localhost IDENTIFIED BY 'xcs'; +GRANT ALL PRIVILEGES ON xcs.* TO xcs@localhost; FLUSH PRIVILEGES; -- diff --git a/additional-material/db/xcs-sample-test-mysql.sql b/additional-material/db/xcs-sample-test-mysql.sql index ad6b19a..7d1fb0b 100644 --- a/additional-material/db/xcs-sample-test-mysql.sql +++ b/additional-material/db/xcs-sample-test-mysql.sql @@ -31,5 +31,6 @@ CREATE TABLE `Pet` ( -- -- User creation -- -GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@localhost IDENTIFIED BY 'xcs'; +CREATE USER IF NOT EXISTS xcs@localhost IDENTIFIED BY 'xcs'; +GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@localhost; FLUSH PRIVILEGES; \ No newline at end of file -- 2.18.1