Created
June 20, 2017 08:56
-
-
Save hfogelberg/7e8004de531674bb27605e2d52e96486 to your computer and use it in GitHub Desktop.
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
Start mysql | |
$ mysql.server start | |
Login as root | |
$ mysql -u root -p | |
Show databases | |
mysql> SHOW DATABASES | |
Create database | |
mysql> CREATE DATABASE my_test_db; | |
Switch database | |
mysql> USE my_test_db; | |
List tables in database | |
mysql> SHOW tables; | |
Create table | |
mysql> CREATE TABLE Posts( | |
-> id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
-> title VARCHAR(50) NOT NULL, | |
-> text TEXT NOT NULL, | |
-> created DATE NOT NULL); | |
Show schema defenition | |
mysql> DESCRIBE Posts; | |
Insert | |
mysql> INSERT INTO `Posts`(`title`, `text`, `created`) VALUES("Hello World", "Lorem Ipsum", NOW()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment