Skip to content

Instantly share code, notes, and snippets.

@Shreeja-tech
Forked from nax3t/cheatsheet.md
Created October 23, 2022 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shreeja-tech/f7c64e00be02bb1127a0dd5a8a583148 to your computer and use it in GitHub Desktop.
Save Shreeja-tech/f7c64e00be02bb1127a0dd5a8a583148 to your computer and use it in GitHub Desktop.
Goorm MySQL Cheat Sheet

Goorm MySQL Cheat Sheet

The purpose of this document is to quickly show you how to get back into your MySQL database after returning from a break

All the commands below will be run from the terminal (command line).

  1. Start by running the mysql service and opening the mysql shell, this can be done simultaneously with a single command:
mysql-ctl cli

If this worked then you should see mysql> in your terminal. You may now enter the following MySQL commands:

  1. List all existing databases:
SHOW DATABASES;
  1. If you see your database then open it with:
USE <db_name>;

Be sure to replace <db_name> with the name of your database.

  1. If you do not see your database then you will need to create it: CREATE DATABASE <db_name>; Again, be sure to replace <db_name> with the name of your database.

  2. Now you can open your newly created database with:

USE <db_name>;

You are now inside of a database and can begin creating tables, querying for data, and so on. Once you are done working, simply type the exit command to quit the MySQL shell and return to the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment