Installation and simple practice of MySQL in ubuntu environment (1)

This article introduces the simple operation of MySQL under ubuntu through two micro projects, from installation to practice, without much to say, directly on the code:

**The first step: Install MySQL: **

1 ), download and install mysql:

sudo apt-get update

sudo apt-get install mysql-server

2 ), configuration properties: sudomysql_secure_installation

3 ), check whether the installation is successful: systemctl status mysql.service;

Step 2: Create a database: firstDB

1 ), enter mysql: sudo mysql –u root –p

2 ), create a database: create database firstDB;

3 ), check whether the creation is successful: show databases;

Step 3: Create a form: email

1 ), enter the database firstDB: use firstDB;

2 ), create a table: createtable email(id int not null primary key,Email varchar(255));

3 ), check whether the creation is successful: show tables;

Step 4: Insert data

1 ), view the properties of the form: desc email;

2 ), insert data:

INSERT INTO email VALUES('1','[email protected]');
INSERT INTO email VALUES('2','[email protected]');
INSERT INTO email VALUES('3','[email protected]');3) View all data in the table: select*from email; 4), query duplicate emails in the email table: select Email from email group by Email having count(Email)>1;
Step 5: Item 2 1), create a table World: CREATE TABLE World(name VARCHAR(50) NOT NULL,continent VARCHAR(50) NOTNULL,area INT NOT NULL,population INT NOT NULL,gdp INT NOT NULL);2) Insert data: INSERT INTO World VALUES('Afghanistan','Asia',652230,25500100,20343000);INSERT INTO World   VALUES('Albania','Europe',28748,2831741,12960000);INSERT INTO World   VALUES('Algeria','Africa',2381741,37100000,188681000);INSERT INTO World  VALUES('Andorra','Europe',468,78115,3712000);INSERT INTO World  VALUES('Angola','Africa',1246700,20609294,100990000);3) If the area of a country exceeds 3 million square kilometers, or(Population exceeds 25 million and GDP exceeds 20 million), Then this country is a big country. Write a SQL query to output the names, populations and areas of all major countries in the table: select name,population,area fromworldwhere(population >25000000 and gdp >20000000)or area >3000000;

Recommended Posts

Installation and simple practice of MySQL in ubuntu environment (1)
Installation and use of SSH in Ubuntu environment
Installation and deployment of Nginx in Ubuntu
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Ubuntu16.04 installation and simple configuration
Installation and use of GDAL in Python under Ubuntu
Happy installation of Jenkins in ubuntu
Ubuntu 19.1 installation and configuration Chinese environment
Installation and use of Mysql under CentOS
Centos-6.5 installation and deployment of LNMP environment
Installation and uninstallation of CUDA under Ubuntu 16.04
Installation and use of Win10 subsystem Ubuntu
Simple practice of RHCS cluster in CentOS6
Installation and configuration of JDK in CentOS 7 system
Installation of pulseaudio and API usage under Ubuntu 12.04
Remotely connect to MySQL database in Ubuntu environment
Installation and configuration of CentOS 7 in VMware Workstation
Ubuntu introduction and installation
Environment configuration of JDK, mysql and tomcat under Centos7
Installation and usage instructions of rz/sz command under ubuntu
Python introduction and environment installation
Centos mysql installation and configuration
Use of Anaconda in Ubuntu
CentOS environment installation of Docker
Ubuntu PostgreSQL installation and configuration
ubuntu offline installation python environment
The problem of MySQL import file failure in CentOS environment
How to install memcache and start it in ubuntu environment
Encountered in the process of building a virtual environment in ubuntu
How to compile and install PHP and Nginx in Ubuntu environment
Introduction to CentOS7 installation process of openjdk, tomcat and mysql
Ubuntu 18.04.1 build Java environment and HelloWorld
Centos7 installation and configuration of Jenkins
Common exceptions and solutions in the use and development of Ubuntu system
Ubuntu environment variables and ADB configuration
Detailed explanation of quick installation and configuration of Subversion (SVN) under Ubuntu
Centos6.5 installation and deployment of KVM
Installation of deb package under Ubuntu
Install and configure MySQL on Ubuntu
CentOS7 installation and maintenance of Gitlab
Install and configure Docker in Ubuntu
Redis installation under ubuntu and windows
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Installation instructions for gitlab in Ubuntu
How to install mysql in Ubuntu 14.04
Installation of Docker CE under Ubuntu
Ubuntu basic settings: introduction to the installation and use of openssh-server
Configuration and beautification after Ubuntu installation (1)
Nginx installation and configuration load (ubuntu12.04)
Ubuntu18.04 installation Anaconda3 and VSCode guide
Coexistence of CUDA8.0 and CUDA9.0 under Ubuntu 16.04
Ubuntu configuration source and installation software
Centos7 mysql database installation and configuration
Description of in parameterization in python mysql
How to compile and install xdebug from source code in Ubuntu environment
Advantages of using apt command to download management package in Ubuntu environment
FreeFileSync: Compare and synchronize files in Ubuntu
Ubuntu installation and deployment Redash operation notes (2020.08)
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Ubuntu18.04 system installation and prerequisite software installation guide
Installation and configuration of redis under centos7