The simplest way to install MySQL on Ubuntu(64-bit) is online installation. 

First, check if MySQL is already installed on your Linux system. Enter the following command:

Input: $ sudo service mysql start

Output: Failed to start mysql.service: Unit mysql.service not found which means you have not install MySQL.

How to install and config MySQL on Ubuntu Linux

So, let's start.

(1) Install MySQL-server and core program

(During the installation process, you will be asked to set  password of the root user)

Input: $ sudo apt-get install mysql-server

How to install and config MySQL on Ubuntu Linux

(2) Install MySQL-client

Input: $ sudo apt-get install mysql-client

How to install and config MySQL on Ubuntu Linux

After installation, you need to use the following command to verify the installation is successful or not.

Input: $ sudo netstat -tap | grep mysql

 if result shows like this, successful! Use it!How to install and config MySQL on Ubuntu Linux

                                                                                 (learn from shiyanlou, https://www.shiyanlou.com/courses/running

Let's open MySQL! How to install and config MySQL on Ubuntu Linux

 

View Database

Pay attention to the semicolon at the end of the command, otherwise you will make a mistake like us.

How to install and config MySQL on Ubuntu Linux

We can see four databases, they are “information_schema”,”mysql”,”performance_schema”  and “sys”.

Connect database

Here, Tonia chooses database “performance_schema” to show how to connect the database.

The format of the command is use <name of database>

How to install and config MySQL on Ubuntu Linux

Quit MySQL

Use the command quit or exit to exit MySQL.

How to install and config MySQL on Ubuntu Linux


TRY! 

Create a Database (Named mysql_tonia)

How to install and config MySQL on Ubuntu Linux

Since a system may have multiple databases, in order to determine which databases is currently operating on,we need to use "use <Name of DB>"

Enter the command "show tables" to see how many tables are in Tonia's db. (Of course, empty!)

How to install and config MySQL on Ubuntu Linux

So, Tonia tries to create some tables,like employee and department.

How to install and config MySQL on Ubuntu Linux

 

相关文章: