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

Deploy Mysql in Rpm mode on Centos

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

Share

Shulou(Shulou.com)06/01 Report--

The environment of this article is as follows:

Operating system: CentOS 6.664 bit

Mysql version: MySQL 5.764 bit

First, install the software

Download the YUM source rpm installation package from the MySQL official website: http://dev.mysql.com/downloads/repo/yum/, select Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package version

Download rpm software

Wget "https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm"

Yum localinstall mysql57-community-release-el6-11.noarch.rpm

Yum repolist enabled | grep "mysql.*-community.*"

1.1. Uninstall the boss Ben

# rpm-qa | grep mysql

# rpm-e mysql-libs-5.1.73-3.el6_5.x86_64-- nodeps

1.2.Configuring the YUM source

Download the YUM source rpm installation package from the MySQL official website: http://dev.mysql.com/downloads/repo/yum/, select Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package version:

Click the download button:

Right-click the No thanks,just start my download to get the link address:

Get the link address: https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm

Get resources:

# wget "https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm"

1.3.Install Mysql source

Yum localinstall mysql57-community-release-el6-11.noarch.rpm

1.4. Check whether the MySQL source is installed successfully

Yum repolist enabled | grep "mysql.*-community.*"

1.5. select the default MySQL installation version

Three versions of MySQL are provided in the source, which are 5.5 and 5.6, and the system installs MySQL5.7 by default. I want to install version 8.0, so change the / etc/yum.repos.d/mysql-community.repo source configuration and change the enabled=1 of the 5.7 source to enabled=0. Then change the enabled=0 of 8.0 source to enabled=1

# vi / etc/yum.repos.d/mysql-community.repo

The modification results are as follows:

1.6. install MySQL8.0

# yum install mysql-community-server

1.7. start the MySQL service

The command for system version 7 is systemctl, but version 6 is service.

Version 7:

# systemctl start mysqld

Version 6:

# service mysqld start

1.8.View the startup status of MySQL

Version 7:

# systemctl status mysqld

Version 6:

# service mysqld status

1.9. Boot

Version 7:

Systemctl enable mysqld

Systemctl daemon-reload

Version 6:

Chkconfig mysqld on

Or

Vi / etc/rc.d/rc.local

Add content:

/ etc/rc.d/init.d/mysqld start

2.0, log in to the database

# mysql-uroot-p

Do not know the password (Mysql above 5.7has a temporary password and has not been reset, restarting mysql will give you a temporary password. )

You can know the temporary password for the current root by using the following command:

# grep "temporary password" / var/log/mysqld.log

After logging in with a temporary password, you need to reset the password as follows:

Mysql > set PASSWORD=PASSWORD ('CentOS@6.6')

Appendix A:root default temporary password

At the beginning of Mysql5.7, a lot of security updates have been added, and users of older versions may not be used to it.

After version 5.7.6, when you install and start the Mysql database for the first time, a temporary password is generated to the log file, as follows:

Cat / var/log/mysqld.log | grep password

The temporary password is:; Wb4A)! o1ned

Use the password to log in to the database, but you can't do anything. You need to change the password first.

Msql > show databases

ERROR 1820 (HY000): you must reset your password using ALTER USER STATEMENT before executing this statement

When you change the password, you will encounter verification, and a simple password will indicate that it does not comply with the rules:

Mysql > ALTER USER 'root@localhost' INDENTIFIED BY' 123'

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

Because a validtate_password plug-in was introduced in 5. 7 to check password strength.

The default values are as follows:

Mysql > show variables like 'vali%'

The meaning is as follows:

Validate_password_check_user_name

Validate_password_dictionary_file

Minimum length of validate_password_length # password, default is 8

Validate_password_mixed_case_count # must contain at least lowercase or uppercase letters. The default is 1.

At least the number of digits to be included in validate_password_number_count #. Default is 1.

Validate_password_policy # strength grade, which can be set to 0, 1, 2. , which defaults to 1

# [0/LOW]: check only the length

# [1/MEDIUM]: check numbers, case, and special characters on the basis of level 0

# [2/STRONG]: 1 check the special character dictionary file based on the level 1

The number of special characters that validate_password_special_char_count # must contain at least. Default is 1. 0.

Therefore, the initial setting password must be greater than 8 digits, containing numbers, uppercase and lowercase letters, and special characters.

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

Wechat

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

12
Report