Posts

Showing posts from July, 2020

Reset root password on MySQL on Windows 10 laptop

Stop SQL Server Create a text file "mysql-init.txt" in C:\temp directory and paste in this content ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; Open a command prompt window and run this command mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 8.0\\my.ini" --init-file="C:\\temp\\mysql-init.txt"

Create a SQL table with autoincrement id and timestamps

CREATE TABLE `tutorials` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `title` varchar(255) DEFAULT NULL,   `description` varchar(255) DEFAULT NULL,   `published` tinyint(1) DEFAULT '1',   `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,   `updatedAt` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,   PRIMARY KEY (`id`) )