Create databse titled "pwd_manager".
CREATE DATABASE pwd_manager
Two tables needed;
CREATE TABLE `accounts` (
`account_id` int NOT NULL,
`username` varchar(20) DEFAULT NOT NULL,
`the_password` varchar(100) DEFAULT NOT NULL,
`salt` varchar(30) NOT NULL,
PRIMARY KEY (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `stored_passwords` (
`location` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`the_password` varbinary(1000) NOT NULL,
`account_id` int NOT NULL,
`notes` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
`username` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`salt` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`website_username` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
KEY `account_id` (`account_id`),
CONSTRAINT `stored_passwords_ibfk_1` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE stored_passwords CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
utf8mb4 allows for 4 bytes per character, and allows more chacracter types. This is very benefitial for storing hashed passwords.
pip install mysql-connector-python
- Create a seperate file titled pwd.txt. In pwd.txt, type the password you use to log in to your MySQL.
- Also, if needed, change the following code in main.py to your correct credentials
mydb = mysql.connector.connect(host="localhost",
user="root",
password=pwd,
database='pwd_manager')