Centos 7 install MYSQL8.0

1. First go to the MYSQL official website to download mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar, there are several versions, some are for cluster use, some are for single machine. I downloaded the standalone


Because the operation searched for many posts, the operation was a bit messy. Do it in order and it should work.

groupadd mysql

      useradd -r -g mysql -s /bin/false mysql

This is what I unzipped. . .

mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.11-1.el7.x86_64.rpm
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-devel-8.0.11-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-server-minimal-8.0.11-1.el7.x86_64.rpm

mysql-community-test-8.0.11-1.el7.x86_64.rpm

Check the installed MYSQL and uninstall

rpm -qa | grep mysql

Use the command rpm -e --nodeps {-file-name}to remove, there may be dependencies when removing, pay attention to a certain order.

There is only one MYSQL or something in my system. I uninstalled only one and restarted it.

Third, use the rpm command to install the MySql component

      Install using the command rpm -ivh {-file-name}.

copy code
 1 [root@sxl129 Downloads]# rpm -ivh mysql-community-common-5.7.20-1.el6.x86_64.rpm
 2 warning: mysql-community-common-5.7.20-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
 3 Preparing...                ########################################### [100%]
 4    1:mysql-community-common ########################################### [100%]
 5 [root@sxl129 Downloads]# rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm
 6 warning: mysql-community-libs-5.7.20-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
 7 Preparing...                ########################################### [100%]
 8    1:mysql-community-libs   ########################################### [100%]
 9 [root@sxl129 Downloads]#  rpm -ivh mysql-community-libs-compat-5.7.20-1.el6.x86_64.rpm
10 warning: mysql-community-libs-compat-5.7.20-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
11 Preparing...                ########################################### [100%]
12    1:mysql-community-libs-co########################################### [100%]
13 [root@sxl129 Downloads]# rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm 
14 warning: mysql-community-client-5.7.20-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
15 Preparing...                ########################################### [100%]
16    1:mysql-community-client ########################################### [100%]
17 [root@sxl129 Downloads]# rpm -ivh mysql-community-server-5.7.20-1.el6.x86_64.rpm
18 warning: mysql-community-server-5.7.20-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
19 Preparing...                ########################################### [100%]
20    1:mysql-community-server ########################################### [100%]
copy code

      Note: In ivh, installation; progress bar; hash check i-installv-verboseh-hash

The above is to copy the installation sequence of others and that's it.

4. Log in and create a MySql password

      1. Start Mysql

      Once installed, service mysqld startstart the MySQL service using the command.

      2. Modify the password of MySql

      Since there is no password by default in versions before MySQL 5.7.4, you can enter the database directly after logging in, and then perform operations such as setting a password. Subsequent versions have made some changes to security-related operations such as passwords. During the installation process, a random password will be generated in the installation log.

      How to find this random password?

      use:

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

      You can query a log record similar to the following:

1 [root@sxl129 Downloads]# grep 'temporary password' /var/log/mysqld.log
2 2017-12-03T10:34:49.423162Z 1 [Note] A temporary password is generated for root@localhost: hqQRMP:D)9Q&

       hqQRMP:D)9Q& is the login password. Use this random password to log in, then change the password,use the command:

   mysql -uroot -p

The above is to copy someone else's, and there is no problem in starting the service. There is no problem finding the password, and then the login prompts an error.

[root@localhost www]# mysql -uroot -pvgJp_8Wft+7
mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Then go to Baidu to find the answer.

It's useless to find the answer for a long time, because I copied the wrong password and lost one / the password is / vgJp_8Wft+7

Too pit. . . Then log in

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Chai123!'

Change the password, it can't be too simple or too simple and an error is reported. Anyway, 8 and 5.7 have strengthened password verification. 

I tried to find parameters to simplify the password strength, but it didn't work. .

Let's do this first. Explore later!


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324819126&siteId=291194637