MySQL core basics (1)-first acquainted with MySQL, start and stop, login and exit

One, the related concepts of the database

  • DB database (database): the "warehouse" for storing data. It saves a series of organized data.
  • DBMS database management system (Database Management System). A database is a container created and operated by a DBMS.
  • SQL structured query language (Structure Query Language): a language specifically used to communicate with the database.

Second, the characteristics of database storage data

Realize data persistence

Use a complete management system for unified management, easy to query

Three, the initial MySQL

MySQL service start and stop★

Method 1: Right-click on the computer through the computer management mode—manage a service and start or stop the MySQL service

Method 2: Via the command line

Start: net start mysq service name

Stop: net stop mysql service name

Login and logout of MySQL service★

◆Log in to mysql -h host name -u user name -p password
◆Exit exit

MySQL's common commands and grammar specifications

◆Case-insensitive
◆Use for
each sentence; at the end ◆All clauses are generally written in separate lines
◆Keywords cannot be abbreviated or split into lines
◆Use indentation to improve the readability of sentences

  1. Enter mysql, enter in the command line: mysql -uroot -p# (where: # represents the password)

  2. Check which databases are in mysql: show databases;

  3. Use a database: use database name;

  4. Create a new database: create database: database name

  5. View which data tables are in the specified database: show tables;

  6. Build a table

    create table customer(id varchar30,
    age int,
    name varchar,
    birthday date);
    
  7. View the structure of the table: desc table name

  8. Drop table: drop table table name

Guess you like

Origin blog.csdn.net/kilotwo/article/details/104355017