MYSQL5.7 detailed installation steps: nanny-level tutorial

The following are the installation steps of MySQ. There are many pitfalls during the installation process. I have written them one by one below. I hope it will be helpful to you, la la la

yum install wget -y If no wget is installed, wget is a download tool

 mv CentOS-Base.repo CentOS-Base.repo.backup change the file name, (this step is to change the yum source later, the downloaded yum source is named CentOS-Base.repo)

Replace yum source:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

Update the local cache:

yum clean all

yum makecache 

Check if the system comes with mysqk, it is not displayed on my machine, it means it is not, if the system has it, you need to delete yum -y remove mysql-libs.x86_64

Download the yum installation package of mysql

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

Install mysql

yum install mysql-community-release-el6-5.noarch.rpm -y

cd /etc/yum.repos.d Switch to this directory, after the installation is complete, two mysql-related files will appear

vim mysql-community.repo modify the configuration file, modify the download source to version 5.7

before fixing

After modification

Use yum to install mysql

yum install mysql-community-server -y

Report an error during installation

Error: Package: mysql-community-server-5.7.33-1.el6.x86_64 (mysql57-community-dmr)

           Requires: libsasl2.so.2()(64bit)

 

https://blog.csdn.net/qq_38417808/article/details/81291588 Solve the blog

Modify the vim /etc/yum.repos.d/mysql-community.repo  source file

来自 <https://blog.csdn.net/qq_38417808/article/details/81291588>

before fixing:

After modification:

 

Re-execute the yum install mysql-community-server -y operation after the modification is completed 

Check the startup status:

systemctl status mysqld

Update the yum certificate yum update -y

A temporary password needs to be generated before startup, a certificate is required, and the certificate may expire, and an update operation is required

 

At this point mysql has been started, you need to check the mysql startup password by viewing the log:

grep root@localhost /var/log/mysqld.log 

or

grep 'temporary password' /var/log/mysqld.log

Log in to mysql at this time and enter this password

Ahhhhhhhh! My temporary password is directly copied and pasted, or the actual password is wrong. . . Have not been able to board,

Solution, there may be a problem with the temporary password, try to generate the temporary password again:

The operation is as follows:

 service mysqld stop stops the mysql server first,

rm -rf /var/lib/mysql delete this mysql folder, in order to regenerate temporary files when restarting

systemctl restart mysqld restart mysql server

grep'temporary password' /var/log/mysqld.log found two pieces of data, the bottom one is the first password

Execute mysql -u root -p

Then enter the temporary password and finally log in

change Password:

Change to a simple password for easy login,

First adjust the password level, then change the password

set global validate_password_policy=0;

set global validate_password_length=1;

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

Modify the encoding method

Vim /etc/my.cnf

#Add in the [mysqld] section:

character-set-server=utf8

#Add a [client] section at the end of the file, and add in the [client] section:

default-character-set=utf8

View code:

 show variables like "%character%";

Use Navicat to connect successfully:

 

The Chinese form is inserted successfully!

Guess you like

Origin blog.csdn.net/yanfei464486/article/details/114019161