MySQL basic introduction and configuration

MySQL Four Parts

serial number article
1 Four ways to build a MySQL environment
2 MySQL basic introduction and configuration
3 MySQL basic statement

insert image description here

1. Introduction to MySQL

1. What is a database

  1. Simply put, a database is a warehouse for storing data .
  2. The essence of the database is a file system, which is stored on the computer of the server in the form of files.
  3. All relational databases can be managed using common SQL statements .

2. Advantages of databases

Compare the data stored in Java to know

First create an object and store the object in memory

Demo demo = new Demo("Hello World");

Then save the data to a file through the Java IO stream

storage location advantage shortcoming
RAM high speed It cannot be saved permanently, the data is in a temporary state
document Data can be stored permanently It is inconvenient to operate data, and it is not easy to query data
database ①Data can be permanently saved
②Fast query speed
③Easy data management
④Easy data transfer
Very resource-intensive, need to pay

Therefore, it is important to choose a software that can manage data in a unified manner

3. Why choose MySQL

insert image description here
insert image description here

  • Oracle : A large database for a fee, a product of Oracle Corporation, the most secure database in the world.
  • MySQL : Open source free database, developed by the Swedish MySQL AB company, and later acquired by Oracle. Due to its open source, many manufacturers use MySQL and customize their own databases based on MySQL.
  • SQL Server : Microsoft Corporation's fee-based database. With a graphical user interface, system management and database management are more intuitive and simple.

The top three databases are only MySQL open source, and it can be seen from the DB-Engines ranking that MySQL is almost equal to Oracle, and has gradually become the most mainstream database in the world, so we use MySQL to learn.

4. Database installation

2. Use of the database

In order to simulate the database environment more realistically, here is used to 宝塔面板build database

1. Create the database

On the pagoda panel, click Database --> Add Database , enter the username and password, set the access permission to everyone, and click Create.
insert image description here

2. Basic use of the database

1. Start the database

  • On CentOS
    On Linux, MySQL is generally started automatically by default. If you build a server to perform the following operations, you can skip this step.
    But if your MySQL service is not enabled by default, you can enable and disable it with the following commands.
/etc/init.d/mysqld start  ## 开启

insert image description here

/etc/init.d/mysqld stop  ## 关闭

insert image description here

  • on Windows
net start mysql  ## 开启
net stop mysql  ## 关闭

2. Connect to the database

1. Connect on the (local) server
mysql -u用户名 -p密码

Note that there is no space after and-u , followed by your user name and password.-p

After the connection is successful, the following will occur.
insert image description here

2. Remote connection

Sometimes we may want to operate the database of the remote server on our own computer, then we need to try the following commands:

mysql -h服务器IP地址 -u用户名 -p密码

Also, -h -u -pthere is no space after the .
insert image description here

3. Exit the database

To exit the database just enter quit, exit, or Ctrl Zdirectly in MySQL

  • quit
    insert image description here
  • exit
    insert image description here
  • Ctrl Z
    insert image description here

3. Use graphical management tools

1. Software introduction

SQLyog is a simple, efficient and powerful graphical MySQL database management tool produced by the well-known Webyog company in the industry. Using SQLyog can quickly and intuitively allow you to maintain a remote MySQL database from any corner of the world through the network.

2. Installation method

First download the installation package, link
Extraction code: nep0

Click the installation package to start the installation
insert image description here
and keep clicking Next.

insert image description here
Finally enter the name and certificate key to activate
insert image description here

3. Use the tutorial

Click New to create a new connection, just fill in the name
insert image description here

Fill 服务器的地址in the address of yourself or your own machine, enter the database 用户名, 密码and 数据库click 连接to
insert image description here
enter the following interface, which means the connection is successful.
insert image description here

Guess you like

Origin blog.csdn.net/qq_21484461/article/details/123580583