preface

Mysql is the most popular relational database in the Web Server. It is lightweight and easy to learn and use. It is the most commonly used storage tool in enterprises and is usually operated and maintained by special personnel. Therefore, it is a good choice to choose mysql as your starting database. Let’s enter the body

MySql installation and configuration

1. Download it from the official website

2. Decompress the file to the working directory

3. Configure the bin folder Path to my computer -> Properties -> Advanced System Settings -> Environment Variables -> System Variables Path

4. Create a mysql.ini file in the mysql folder

[mysqld] [mysqld] [mysqld] [mysqld] [mysqld] [mysqld] [mysqld] [mysqld] [mysqld] [mysqld Basedir =D:\soft\mysql-8.0.28-winx64 # Set the maximum number of connections allowed for mysql database datadir=D:\soft\mysql-8.0.28-winx64 Max_connections =200 # Latin1 character set character-set-server =utf8 # Default storage engine to be used when creating new tables default-storage-engine=INNODBCopy the code

5. Open CMD and enter mysqld install. Open CMD as administrator: Use Win +Q to search CMD, right-click “Open as administrator”

6. Run mysqld –initialize-insecure to generate a data folder in the root directory

7. Start the service: net start mysql

8. Initialize the account password: mysql -u root -p Command and press Enter. If you need to enter a password, press Enter to log in to the database without a password

Log in to mysql and run show global variables like ‘port’.

Create a database: create database name;

11. Check all databases: show databases;

12. Quit;

Net stop mysql (remember that in mysql services, commands are always marked with a semicolon; Is not required outside the mysql service.)

MySql Workbench is a graphical interface tool for MySql operations

MySQL Workbench is visual database design software, database administrators and developers to provide a set of visual database operating environment, The main functions are database design and model building, SQL development (replacing MySQL Query Browser), database management (replacing MySQL Administrator).

1. Download it from the official website

2. Create a database and table

3. Command input in MySQL Workbench

1. Click the "SQL +"icon button in the upper left corner. 2. 3. Then select the content and click on the yellow lightning bolt to see output 4. Here are some general commands -- select myblog database use myblog; Mysql > alter table myblog show tables; Insert into users(username, 'password ', realname) value ('lis','223',' li '); Select * from users; select * from users; Select id, username from users; Select * from users where username=' Tom '; select * from users where username=' Tom '; Select * from users where username='zhangsan' and password = 123 select * from users where username='zhangsan' and `password`='123'; Select * from users where username='zhangsan' or 'password' ='223'; select * from users where username=' Tom 'or' password '='223';  Select * from users where password = '%2%'; select * from users where password = '%2%'; Select * from users where password like '%2%' order by time; select * from users where password like '%2%' order by time; SQL > alter table realNAME; SQL > alter table realname; SQL > SET SQL_SAFE_UPDATES=0; Update users set realName ='lisi' where username='lisi'; SET SQL_SAFE_UPDATES=0; Delete from users where username='lisi'; Update users set state='0' where username='lisi'; select * from users where username='lisi'; - to blogs data table insert insert into blogs (title, content, createtime, author) values (' title BBB and BBB 'content', 1641299426627, 'lisibb'); Select * from blogs; Select * from blogs ORDER by createTime; Select * from blogs order by createtime desc; Select * from blogs where author='lisi' order by createTime; select * from blogs where author='lisi' order by createTime; Select * from blogs WHERE title like '% title %' order by createTime; select * from blogs WHERE title like '% title %' order by createTime;  Select version() from mysqlCopy the code