From 4e4520b6fa5abc5b6be5b0f6f703aabcce342da4 Mon Sep 17 00:00:00 2001 From: Miguel Reboiro-Jato Date: Tue, 18 Feb 2020 18:04:58 +0100 Subject: [PATCH] Fixes DB authentication error for MySQL 8.0.4+ The default authentication plugin for MySQL has been changed from mysql_native_password to caching_sha2_password in version 8.0.4. This causes that an access failure for the user created in the database scripts when trying to login from Tomcat. This commit changes the MySQL database scripts to maintain the compatibility between Tomcat and MySQL in versions 8.0.4+. --- db/mysql-with-inserts.sql | 2 +- db/mysql.sql | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/mysql-with-inserts.sql b/db/mysql-with-inserts.sql index 147500d..f678c3e 100644 --- a/db/mysql-with-inserts.sql +++ b/db/mysql-with-inserts.sql @@ -14,7 +14,7 @@ CREATE TABLE `daaexample`.`users` ( PRIMARY KEY (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE USER 'daa'@'localhost' IDENTIFIED BY 'daa'; +CREATE USER 'daa'@'localhost' IDENTIFIED WITH mysql_native_password BY 'daa'; GRANT ALL ON `daaexample`.* TO 'daa'@'localhost'; INSERT INTO `daaexample`.`people` (`id`,`name`,`surname`) VALUES (0,'Antón','Pérez'); diff --git a/db/mysql.sql b/db/mysql.sql index fc0f895..8fc20db 100644 --- a/db/mysql.sql +++ b/db/mysql.sql @@ -14,5 +14,5 @@ CREATE TABLE `daaexample`.`users` ( PRIMARY KEY (`login`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE USER 'daa'@'localhost' IDENTIFIED BY 'daa'; +CREATE USER 'daa'@'localhost' IDENTIFIED WITH mysql_native_password BY 'daa'; GRANT ALL ON `daaexample`.* TO 'daa'@'localhost'; diff --git a/pom.xml b/pom.xml index c493311..fb18885 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ es.uvigo.esei.daa example war - 0.1.15 + 0.1.16 DAA Example -- 2.18.1