Create a database with MariaDB, SQL practice, install and use MariaDB

Preface: The MariaDB database management system is a branch of MySQL, mainly maintained by the open source community. The purpose of using the GPL license MariaDB is to be fully compatible with MySQL, including API and command line, so that it can easily become a substitute for MySQL. In terms of storage engine, use XtraDB to replace MySQL's InnoDB. 

1. The installation package clicks to install, and the next step is fine.

Download MariaDB Server - MariaDB.org

Note: Do not choose the C drive as the installation path

During the period, set the default server host, and set the account and password to root, which is easy to remember

 

2. After the installation is successful, check the icon

It will generate MariaDB icon, and the associated viewing tool HeidiSQL. Generally, it is not on the desktop, but in "Start" Recently Added. (You can move the shortcut icon to the desktop)

3. Connect to the database and use the HeidiSQL tool software associated with mariaDB

4. Configure account password, database name

If the database is not created, just enter the password set during installation by default, first connect to the host, do not specify the database name, click Open to enter

5. Query the default database

5. Create a database

6. Check database, build database, look up table, build data table, insert data

7. Sample SQL practice:

Note: The selected content executes the command separately, and the utf8mb4 encoding is used when creating the table, which is compatible with Chinese

#选择内容可单独执行命令
#建库
CREATE DATABASE new_data222;

#查库
SHOW databases;

#用库
USE new_data222;

#建表
# 使用utf8mb4编码,可以兼容中文
CREATE TABLE student(
sno CHAR(10) PRIMARY KEY,
name VARCHAR(100),
age int(2),
score int(10)
)DEFAULT CHARSET = utf8mb4 COMMENT ='学生表';;

#建表
CREATE TABLE teacher(
tno CHAR(10) PRIMARY KEY,
name VARCHAR(200),
age int(2)
)DEFAULT CHARSET = utf8mb4 COMMENT ='老师表';;

#查表
SHOW tables;

#插入
insert into student values('s001','何同学',21,101);
insert into teacher value('t001','王老师',34);

#查询数据
select sno , name ,age ,score from student;



More SQL exercises: Mysql database combat

Create value, happy to share! 776147358

Guess you like

Origin blog.csdn.net/ly_xiamu/article/details/132227899