Download and install mysql (on linux and windows)

1. Download the mysql.tar package on linux

Note: Before installation, check if there is any on this machine, and delete if there is

// rpm -qa | grep  mysql
// rpm -qa | grep  Mysql
// rpm -qa | grep  mariadb

1. Download the tar package

//可以通过wget下载tar包,没有wget的话,可以使用  yum -y install  wget 进行下载
// 下面这个地址就是 tar包地址,里面的rpm包相关依赖都包含了
  wget  https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25-1.el7.x86_64.rpm-bundle.tar
  1. Decompress (I decompressed directly to the current directory here)
   tar  -xvf  mysql-5.7.29-1.el7.x86_64.rpm-bundle.tar

Here is after I decompressed it, I will get the rpm file and need to be installed

Insert picture description here

Execute the following commands in order to install (because there is a dependency), you need to
pay attention in order : it is version 5.0, and the installation order of version 8.0 is still not the same (in short, the installation failure solution depends on which one is dependent , It's ok to install the dependent installation package first)

1.sudo rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm 
2.sudo rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
3.sudo rpm -ivh mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm 
4.sudo rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
5.sudo rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
  1. After all the installation is complete, you need to initialize the database ()
// 对了, 这里还得先到 /var/lib/mysql下 看有其他文件没有,有的话,先进行删除
  mysqld   --initialize--user=mysql
  1. Go to /var/log/mysql.log to find the initial password and


log in:

  先启动数据库: systemctl  start mysqld
  进入数据库 : mysql  -uroot  -p密码

6. Set the password level, for the password to be easy to set

Set password strength to low level: set global validate_password_policy=0;
set password length: set global validate_password_length=4;
refresh permissions: flush privileges;

Modify password: set password=password("new password");

Note: Modified to allow remote login.
Modify remote login: update set host = “%” where user=“root”

Note: It is not necessary to set, default: the length is 8 and must contain numbers, uppercase and lowercase, special characters

Other ways to modify the password:

   mysqladmin   -uroot  -p原密码  password  新密码
Insert picture description here

In this way, the installation of the database is completed and can be used normally