Created
September 10, 2018 14:02
-
-
Save HendrikEduard/0f23bc7af904509f9d9366cf9e690a1a to your computer and use it in GitHub Desktop.
MySQL "Admin" table sql
This file contains 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
-- | |
-- You will see several spelling errors. | |
-- These are intentional. Whichever language you speak/use always make spelling mistakes!! | |
-- | |
CREATE DATABASE IF NOT EXISTS `8dCXCpnx!UT8U+dO=2` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; | |
USE `8dCXCpnx!UT8U+dO=2`; | |
-- Table structure for table `administators` | |
-- The Admin password is 7648edd7ddbd1ce2 | |
CREATE TABLE `administators` ( | |
`id` int(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
`first_name` varchar(32) NOT NULL, | |
`last_name` varchar(32) NOT NULL, | |
`adminame` varchar(56) NOT NULL, | |
`login_id` varchar(56) NOT NULL, | |
`password` varchar(256) NOT NULL, | |
`lader` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0-pending,1-verified,4-comment,5-blog,6-article,7-editor,8-manager,9-owner,11-me', | |
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
`created_by` varchar(56) DEFAULT NULL, | |
`modified_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
`modified_by` varchar(56) DEFAULT NULL, | |
`is_deleted` int(1) NOT NULL DEFAULT '0' | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; | |
-- Insert your 1st record into the table `administators` | |
-- In your insert/update sql you only need the following: | |
INSERT INTO `administators` ( `first_name`, `last_name`, `adminame`, `login_id`, `password`, `lader`) VALUES | |
('PeterPaul', 'AndMary', 'puff the magic dragon', '69f866138a3d5fb8', '$2y$10$EYncwRxhA/SAO1PGo/Q6tewXjAa6hWkgGkiZDPYZbw9uERlpTHYYm', 11); | |
-- Create view `admins` | |
-- A view is ONLY to view records - never to modify them. | |
CREATE VIEW `admins` AS SELECT * FROM `administators` WHERE `lader` > 0 and `is_deleted` = 0 | |
This file contains 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
Copyright 2018 Hendrik Eduard Kuiper | |
Permission is hereby granted, free of charge, to any person obtaining a | |
copy of this software and associated documentation files (the "Software"), | |
to deal in the Software without restriction, including without limitation the | |
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
sell copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in | |
all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment