Last active
September 7, 2021 14:06
-
-
Save soft2help/cd0c2cedd3bfb3fcff1b30b48c5d34d8 to your computer and use it in GitHub Desktop.
Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE USER 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD'; | |
| GRANT ALL PRIVILEGES ON DATABASE_NAME.* TO 'USERNAME'@'%'; | |
| FLUSH PRIVILEGES; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use master; | |
| CREATE LOGIN [USERNAME] WITH PASSWORD=N'PASSWORD', DEFAULT_DATABASE=[DATABASE_NAME], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF; | |
| use DATABASE_NAME; | |
| CREATE USER [USERNAME] FOR LOGIN [USERNAME]; | |
| ALTER USER [USERNAME] WITH DEFAULT_SCHEMA=[dbo] | |
| ALTER ROLE [db_datareader] ADD MEMBER [USERNAME]; | |
| ALTER ROLE [db_datawriter] ADD MEMBER [USERNAME]; | |
| ALTER ROLE [db_owner] ADD MEMBER [USERNAME]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment