forked from vincent/notebook
66 lines
1.5 KiB
MySQL
66 lines
1.5 KiB
MySQL
|
-- cr<63>er trois comptes de connexion :
|
|||
|
-- CNX_LECTEUR
|
|||
|
-- CNX_ECRIVAIN
|
|||
|
-- CNX_ADMIN
|
|||
|
-- langage fran<61>ais, base par d<>faut DB_GRAND_HOTEL
|
|||
|
-- mot de passe => 'SQL2019x'
|
|||
|
USE master;
|
|||
|
GO
|
|||
|
|
|||
|
CREATE LOGIN CNX_LECTEUR
|
|||
|
WITH PASSWORD = 'SQL2019x',
|
|||
|
DEFAULT_LANGUAGE = Fran<EFBFBD>ais,
|
|||
|
DEFAULT_DATABASE = DB_GRAND_HOTEL;
|
|||
|
|
|||
|
CREATE LOGIN CNX_ECRIVAIN
|
|||
|
WITH PASSWORD = 'SQL2019x',
|
|||
|
DEFAULT_LANGUAGE = Fran<EFBFBD>ais,
|
|||
|
DEFAULT_DATABASE = DB_GRAND_HOTEL;
|
|||
|
|
|||
|
CREATE LOGIN CNX_ADMIN
|
|||
|
WITH PASSWORD = 'SQL2019x',
|
|||
|
DEFAULT_LANGUAGE = Fran<EFBFBD>ais,
|
|||
|
DEFAULT_DATABASE = DB_GRAND_HOTEL;
|
|||
|
GO
|
|||
|
|
|||
|
--> TESTEZ si vous arrivez <EFBFBD> vous connecter !
|
|||
|
|
|||
|
USE [DB_GRAND_HOTEL]
|
|||
|
GO
|
|||
|
|
|||
|
-- cr<63>er 3 utilisateurs SQL relatif <20> ces comptes de connexion
|
|||
|
-- USR_LECTEUR
|
|||
|
-- USR_ECRIVAIN
|
|||
|
-- USR_ADMIN
|
|||
|
|
|||
|
CREATE USER USR_LECTEUR
|
|||
|
FOR LOGIN CNX_LECTEUR;
|
|||
|
|
|||
|
CREATE USER USR_ECRIVAIN
|
|||
|
FOR LOGIN CNX_ECRIVAIN;
|
|||
|
|
|||
|
CREATE USER USR_ADMIN
|
|||
|
FOR LOGIN CNX_ADMIN;
|
|||
|
|
|||
|
-- USR_REPORT qui se connecte directement avec le mot passe 'SQL2019report', langage fran<61>ais
|
|||
|
IF EXISTS(SELECT *
|
|||
|
FROM sys.configurations
|
|||
|
WHERE name = 'contained database authentication'
|
|||
|
AND value_in_use = 0)
|
|||
|
BEGIN
|
|||
|
EXEC ('EXEC sp_configure ''contained database authentication'', 1;')
|
|||
|
EXEC ('RECONFIGUE;')
|
|||
|
END;
|
|||
|
GO
|
|||
|
|
|||
|
USE [master]
|
|||
|
GO
|
|||
|
ALTER DATABASE [DB_GRAND_HOTEL] SET CONTAINMENT = PARTIAL WITH NO_WAIT
|
|||
|
GO
|
|||
|
|
|||
|
USE [DB_GRAND_HOTEL]
|
|||
|
GO
|
|||
|
CREATE USER USR_REPORT
|
|||
|
WITH PASSWORD = 'SQL2019report';
|
|||
|
GO
|