Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed procedure for installing MySQL

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "the detailed process of installing MySQL". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the detailed process of installing MySQL"!

You rarely need to use MySQL in your daily development study. This article will teach you how to install MySQL using RPM management package under Centos7. Talk less and start directly!

The version of MySQL in this paper is 5.7.32

1. The installation server downloads the rpm file on the mysql server side

Download address: https://downloads.mysql.com/archives/community/

Select version: mysql-community-server-5.7.32-1.el7.x86_64.rpm

two。 Upload to server / app/soft

3. Install the components required for mysql

Yum install libaio (optional)

4. Install mysql Server

Rpm-ivh mysql-community-server-5.7.32-1.el7.x86_64.rpm-nodeps-force

If you do not add-- nodeps-- force, you will be prompted to install client dependencies and other errors.

Warning: mysql-community-server-5.7.32-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-client (x86-64) > = 5.7.9 is needed by mysql-community-server-5.7.32-1.el7.x86_64 mysql-community-common (x86-64) = 5.7.32-1.el7 is needed by mysql-community-server-5.7.32-1.el7.x86_64

Check to see if the installation

[root@review-dev soft] # rpm-qa | grep mysql mysql-community-server-5.7.32-1.el7.x86_64

Start mysql and check the status

[root@review-dev soft] # systemctl start mysqld.service-- launch [root@review-dev soft] # systemctl status mysqld.service-- View status ● mysqld.service-MySQL Server Loaded: loaded (/ usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-01-18 11:32:17 CST 15s ago Docs: man:mysqld (8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 7054 ExecStart=/usr/sbin/mysqld-daemonize-pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 6825 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited) Status=0/SUCCESS) Main PID: 7057 (mysqld) CGroup: / system.slice/mysqld.service └─ 7057 / usr/sbin/mysqld-- daemonize-- pid-file=/var/run/mysqld/mysqld.pid

Through the above we have installed the server side of MySQL, at this time is unable to use the MySQL command to log in, but also need to install a Client side!

Install the client

1. Download the rpm file on mysql client

Download address: https://downloads.mysql.com/archives/community/

Select version: mysql-community-client-5.7.32-1.el7.x86_64.rpm

two。 Upload to server / app/soft

3. Install the client

Rpm-ivh mysql-community-client-5.7.32-1.el7.x86_64.rpm-nodeps-force

By the same token, if you don't add the-- nodeps-- force instruction here, you will still have an error like the following

[root@review-dev soft] # rpm-ivh mysql-community-client-5.7.32-1.el7.x86_64.rpm warning: mysql-community-client-5.7.32-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-libs (x86-64) > = 5.7.9 is needed by mysql-community-client-5.7.32-1.el7.x86_64

After installing the Server and client side, you also need to modify some default configurations.

Configuration

Get the original password

Grep "password" / var/log/mysqld.log 2021-01-18T03:32:13.444809Z 1 [Note] A temporary password is generated for root@localhost: R8G > .agr, GaA

two。 Log in to the mysql server with the original password

Mysql-uroot-p enter the password obtained above and enter enter to log in.

3. Modify the password

ALTER USER 'root'@'localhost' IDENTIFIED BY' new password'

Replace 'new password'' with the password you want to set. Note: the password must be set with uppercase and lowercase numbers and special symbols (, /';:, etc.), otherwise it will not be configured successfully.

3.1 modify password security policy if the following error occurs, the new password does not comply with the password policy

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

You can view security policies by using the command SHOW VARIABLES LIKE 'validate_password%';

You can modify the corresponding security policy by command, such as setting the password level to LOW:set global validate_password_policy=LOW;, or setting the password length to 8 set global validate_password_length=6.

Parameters related to mysql password policy:

1) the total length of the validate_password_length fixed password

2) validate_password_dictionary_file specifies the file path for password authentication

3) the validate_password_mixed_case_count password should contain at least the total number of uppercase / lowercase letters

4) the validate_password_number_count password should contain at least the number of Arabic numerals.

5) validate_password_policy specifies the strength verification level of the password. The default is MEDIUM.

6) the validate_password_special_char_count password should contain at least the number of special characters

About the value of validate_password_policy:

LOW: only validate length

MEDIUM: verify length, numbers, case, special characters

STRONG: verify length, numbers, case, special characters, dictionary files

4. Add Telnet users

Create user 'xxxxxx'@'%' identified by' password'; GRANT ALL PRIVILEGES ON *. * TO 'xxxxxx'@'%' identified by password'; flush privileges

The default language of 5.mysql is utf8mb4

By default, the language used by MySQL is latinl, which can be viewed using the status instruction when logging in to the mysql service. It needs to be modified to mainstream utf8mb4.

Exit mysql first, and then add the following to the my.cnf file in the / etc directory (see red box)

Vi / etc/my.cnf

Restart mysql after modification is completed

Systemctl restart mysqld.service

Log in to mysql again and check the status again

Through the above steps, we can use MySQL for development and testing, but at this time MySQL can not be directly used in production, we also have to modify the configuration parameters of the MySQL server to improve its performance and throughput.

For specific parameters, please refer to the following article to optimize the configuration:

Http://javadaily.cn/articles/2019/11/18/1574040329451.html

At this point, I believe you have a deeper understanding of "the detailed process of installing MySQL". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report