CentOS7 installation mysql5.7

Source: Internet
Author: User
Tags lowercase mysql version

1. Configure the Yum source

Download the Yum source RPM installation package on the MySQL website: http://dev.mysql.com/downloads/repo/yum/

# 下载mysql源安装包shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm# 安装mysql源shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm

Check that the MySQL source is installed successfully

| grep "mysql.*-community.*"

See shown indicates successful installation.
You can modify vim /etc/yum.repos.d/mysql-community.repo the source to change the MySQL version of the default installation. For example, to install version 5.6, the 5.7 source of the enabled=1 changed to Enabled=0. Then change the 5.6 source enabled=0 to Enabled=1. The effect after the change is as follows:

2. Install MySQL
shell> yum install mysql-community-server
3. Start the MySQL service
shell> systemctl start mysqld

To view the startup status of MySQL

shell> systemctl Status Mysqld mysqld. Service-mysql Server loaded:loaded (/usr/lib/systemd/system/mysqld. Service; Disabled Vendor preset:disabled) active:active (running) since five2016-06-2404:37:Panax Notoginseng CST; 35min ago Main PID: 2888 (mysqld) CGroup:/system. slice/mysqld. service└─ 2888/usr/sbin/mysqld--da Emonize--pid-file=/var/run/mysqld/mysqld. PIDJune  : Notoginseng:$localhost. localdomain systemd[1]: Starting MySQL Server ... June: Panax notoginseng:  localdomain systemd[1]: Started MySQL Server.  
4. Boot start
shell> systemctl enable mysqldshell> systemctl daemon-reload
5. Modify the root local login password

After the MySQL installation is complete, a default password is generated for root in the/var/log/mysqld.log file. Locate the root default password in the following way, and then log in to MySQL to modify it:

shell> grep ‘temporary password‘ /var/log/mysqld.log

shell> mysql -uroot -pmysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘; 


set password for ‘root‘@‘localhost‘=password(‘MyNewPass4!‘); 

Note: mysql5.7 The password security check plug-in (Validate_password) is installed by default, and the default password check policy requires that the password must contain: uppercase and lowercase letters, numbers, and special symbols, and not less than 8 bits in length. Otherwise you will be prompted for error 1819 (HY000): Your password does not satisfy the current policy requirements error as shown:

You can view information about the password policy through the MSYQL environment variable:

like ‘%password%‘;

Validate_password_policy: Password policy, default to Medium policy
Validate_password_dictionary_file: Password policy file, policy for strong only required
Validate_password_length: Minimum Password length
Validate_password_mixed_case_count: Uppercase and lowercase character length, at least 1
Validate_password_number_count: Number of at least 1
Validate_password_special_char_count: Minimum of 1 special characters
The above parameter is the password check rule for the default policy medium.

There are several password policies:

Strategy Check Rules
0 or Low Length
1 or MEDIUM Length; Numeric, lowercase/uppercase, and special characters
2 or strong Length; Numeric, lowercase/uppercase, and special characters; Dictionary file

MySQL official website Password Policy detailed description: Http://dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_ Validate_password_policy

Modify Password Policy

Add validate_password_policy configuration in/etc/my.cnf file, specify password policy

# 选择0(LOW),1(MEDIUM),2(STRONG)其中一种,选择2需要提供密码字典文件validate_password_policy=0

If you do not require a password policy, add the following configuration to disable the My.cnf file:

validate_password = off

Restarting the MySQL service causes the configuration to take effect:

systemctl restart mysqld
6. Add Telnet user

By default, only the root account is allowed to log on locally, if you want to connect to MySQL on another machine, you must either modify the root to allow remote connections, or add an account that allows remote connections, for security reasons, I add a new account:

7. Configure the default encoding to UTF8

Modify the/ETC/MY.CNF configuration file and add the encoding configuration under [Mysqld] as follows:

[mysqld]character_set_server=utf8init_connect=‘SET NAMES utf8‘

Restart the MySQL service to view the database default encoding as follows:

default configuration file path:
Configuration file:/etc/my.cnf
Log file:/var/log//var/log/mysqld.log
Service startup script:/usr/lib/systemd/system/mysqld.service
Socket file:/var/run/mysqld/mysqld.pid

JPG change rar

CentOS7 installation mysql5.7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.