Basic MySQL Setup on Ubuntu Server

Install MySQL on Ubuntu

It is pretty simple to install MySQL on Ubuntu:

1
2
3
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation

Access the Database

Login to the database

1
mysql -u root -p

Basic Usage

Show all the databases

1
SHOW DATABASES;

Create a database

1
2
3
4
5
CREATE DATABASE database_name;
SHOW DATABASES;
DROP DATABASE database_name;
USE database_name;
SHOW tables;