From 9e31d491b741e924e8ac4b8079c466da05fc8fcf Mon Sep 17 00:00:00 2001 From: 22107988t <22107988t@scm.univ-tours.fr> Date: Mon, 25 Sep 2023 13:38:59 +0200 Subject: [PATCH] =?UTF-8?q?la=20base=20de=20donn=C3=A9es=20configur=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mariadb/rappaurio.sql | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 mariadb/rappaurio.sql diff --git a/mariadb/rappaurio.sql b/mariadb/rappaurio.sql new file mode 100644 index 0000000..6372abb --- /dev/null +++ b/mariadb/rappaurio.sql @@ -0,0 +1,33 @@ +-- Créer la base de données +CREATE DATABASE rappaurio; + +-- Utiliser la base de données +USE rappaurio; + +-- Créer la table "User" +CREATE TABLE User ( + id_user INT AUTO_INCREMENT PRIMARY KEY, + name VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL UNIQUE, + password VARCHAR(255) NOT NULL +); + +-- Créer la table "Search" +CREATE TABLE Search ( + id_search INT AUTO_INCREMENT PRIMARY KEY, + id_user INT, + article1 VARCHAR(255) NOT NULL, + article2 VARCHAR(255) NOT NULL, + date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (id_user) REFERENCES User(id_user) +); + +-- Créer l'utilsateur "radar" +CREATE USER IF NOT EXISTS 'radar'@'%' IDENTIFIED BY '$MYSQL_USER_PASSWORD'; +SET PASSWORD FOR 'radar'@'%' = PASSWORD('$MYSQL_USER_PASSWORD'); + +-- Donne les droits à l'utilisateur "radar" pour la BDD "rappaurio" +GRANT ALL PRIVILEGES ON rappaurio.* TO 'radar'@'%'; + +-- Applique les modifications +FLUSH PRIVILEGES; \ No newline at end of file