Mysql-beginner running service and creating table

run

command prompt window run as administrator

net start mysql starts, net stop mysql closes (it seems to start by default when booting)

If mysql is not started, it seems that the mysql application cannot be opened

You can find mysql in the task manager-service to start

The service can be changed to manual (automatic boot and self-start)

Database creation and deletion

SQL language can be used in mysql, and can also be used in other languages

SQL language classification:

Data Definition Language DDL: create, alter, drop

Data manipulation language DML: insert, update, delete, select

Data Control Language DCL: grant, revoke

Create database:

CREATE DATABASE [IF NOT EXISTS] database name (the brackets can be omitted)

[CHARACTER SET character set name] [COLLATE verification rule name] learning character set with uft-8

View the currently included databases show databases The database language ends with ;

Create database create database name;

Manage database

alter database name to modify the character set of this database

drop database name drop database

use name to enter a database and want to switch to another database, use use xxx again,

define table

create table name

(name type

);

example:

create table student

(sno char(4) not null, char(4) can store two Chinese characters

sname char(10), char(10) can store two Chinese characters

ssex char(2)); char(2) can store a Chinese character

a total of three columns

Define data types to save memory space

show tables; View the tables under the current database

desc name; view the structure under the current table

example:

Guess you like

Origin blog.csdn.net/m0_59069134/article/details/126722354