MySQL Foundation reinforcement--sql Introduction and MySQL Installation

Source: Internet
Author: User
Tags builtin mysql in

2.1 Database and SQL concepts

A database ( Database ) is a warehouse that organizes, stores, and manages data in accordance with its structure, which has been generated more than 60 years ago. With the development of information technology and market, the database becomes ubiquitous: it is widely used in many fields such as e-commerce and banking system, and becomes an important part of its system.

Database used to record data, the use of database record data can show the relationship between various data, but also can easily be recorded data to increase, delete, change, check and other operations.

The Structured Query Language ( Structured Query Language ), referred to as SQL, was developed by IBM in the 70 and used to manipulate databases. In more detail, SQL is a database query and programming language for accessing data and querying, updating, and managing relational database systems, as well as the extension of database script files.

2.2 MySQL Introduction

MySQL is a DBMS (database management System), developed by the Swedish Mysqlab company, currently belongs to the Oracle company, MySQL is the most popular relational database management system (relational database, is built on the basis of relational database model database, Using concepts and methods such as set algebra to process data in a database. Because of its small size, fast speed, low total cost of ownership, especially the open source of this feature, the general small and medium-sized web site developers have chosen MySQL as the site database. MySQL operates using the SQL language.

2.3 MySQL Installation

Note: The lab building environment has been installed MySQL, can be used directly, no need to install again, the following installation is only for everyone to learn to use.

2.3.1 Pre-installation checks

To check if MySQL is already installed on your Linux system, enter the command to try to open the MySQL service:

sudo service mysql start

When you enter a password, the following prompt indicates that MySQL is already installed in the system:

If this is the case, then there is no MySQL in the system and you need to continue with the installation:

mysql: unrecognized service
2.3.2 Ubuntu Linux Installation configuration MySQL

The simplest way to install MySQL on Ubuntu is to install it online. Only a few lines of simple commands ( # followed by comments) are required:

#安装 MySQL 服务端、核心程序sudo apt-get install mysql-server#安装 MySQL 客户端sudo apt-get install mysql-client          

During installation, you will be prompted to confirm the input yes, set the root user password (which can then be modified), etc., and wait a few moments for the installation to succeed.

After the installation is complete, use the command to verify that it is installed and started successfully:

| grep mysql 

If the following prompt appears, the installation succeeds:

At this point, you can modify the MySQL configuration file (my.cnf) with gedit according to your own needs, using the following command:

sudo gedit /etc/mysql/my.cnf 

At this point, MySQL has been installed, configured to complete, can be used normally.

2.3.3 Try MySQL

1). Open MySQL

Use the following two commands to open the MySQL service and log in with the root user:

# 启动 MySQL 服务sudo service mysql start             # 使用 root 用户登录,实验楼环境的密码为空,直接回车就可以登录mysql -u root

The following prompt will appear for successful execution:

2). View the database

Use show databases; the commands to see which databases are available (be careful not to omit the semicolon ; ):

There are already three databases, namely "Information-schema", "MySQL", "Performance-schema".

3). Connect to the database

Choose to connect one of the databases, the statement format is use <数据库名> , here can not add a semicolon, here we select the information_schema database:

use information_schema

4). View Table

Use the commands to show tables; see which tables are in the database (be careful not to miss out ";") ):

5). Exit

Use the command quit or exit quit MySQL.

MySQL Foundation reinforcement--sql Introduction and MySQL Installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.