Saber2pr's Blog


Mysql is also a server, set up the database, and then the code connects to server according to the ip port account password. Docker installation is recommended for software like this server type:

pull images from the nearest region

docker pull mysql/mysql-server:8.0.25-1.2.3-server

Create a container

docker run --name=mysql1 -d -p 3306:3306 mysql/mysql-server:8.0.25-1.2.3-server --default-authentication-plugin=mysql_native_password

Get the initial password

docker logs mysql1 2>&1 | grep GENERATED

Log in

docker exec -it mysql1 mysql -uroot -p

Modify the password

alter user 'root'@'localhost' identified by '密码';

Modify permissions

use mysql;
update user set host='%' where user='root';
flush privileges;

Log into the database

mysql -u root -p

Create a database

CREATE DATABASE your_db_name;

tice that there is a semicolon at the end Then the rest of the table is directly linked with typeorm.