MySQL5.7 Change Password

Source: Internet
Author: User
Tags lowercase mysql version

MySQL5.7 out quite a long time, today with the official RPM package installed to play again, and the value before the version of some differences, mark under.


OS Platform:centos 7.3


Install MySQL version 5.7, official website http://dev.mysql.com/downloads/repo/yum/

RPM-IVH http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm


Yum Installation:

Yum-y Install Mysql-community-server


Speed is not fast, slowly wait ...


Change DataDir

Sed-i ' s/datadir=/var/lib/mysql/datadir=/data/mysql/'/etc/my.cnf

Start the database

/etc/init.d/mysqld Start #该过程包含初始化数据库


MySQL5.7 new feature, in order to enhance security, for the root user randomly generated a password, in the/var/log/mysqld.log file to root generated a default password. Locate the root default password in the following way, and then log in to MySQL to modify it:

# grep ' temporary password '/var/log/mysqld.log2017-08-16 t14:51:45.705458z 1 [Note] A temporary password is generated for [Email protected]: a&sqr7dou7n_mysql-uroot-p ' a&sqr7dou7n_ '

After landing, the normal operation will be limited, prompting you must change the password before you can operate, according to the prompt to change the password:

mysql> SET PASSWORD = PASSWORD (' 123456 '); ERROR 1819 (HY000): Your password does not satisfy the current policy requirementsmysql> SET password = password ("root" ); ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

However, the password set is not allowed according to the current password policy.
After reviewing the official documentation, we found the following three password policies:
Policy Tests performed
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

The current password policy defaults to 1, which is MEDIUM

Mysql [email protected]:(None) > show VARIABLES like  "%password%" +------------ ---------------------------+---------+| variable_name                          |  value   | | ---------------------------------------+---------||  default_password_lifetime             |  0       | |  disconnect_on_expired_password        | ON       | |  log_builtin_as_identified_by_password | off     | |  mysql_native_password_proxy_users     | off     | |  old_passwords                         | 0        | |  report_password                        |         | |  sha256_password_proxy_users           | off      | |  validate_password_dictionary_file     |          | |  validate_password_length               | 8       | |  validate_password_mixed_case_count    | 1        | |  validate_password_number_count        | 1        | |  validate_password_policy               | medium  | |  validate_password_special_char_count  | 1       |+---- -----------------------------------+---------+13 rows in settime: 0.030s

The policy to change the password is a numeric lowercase letter with a special character length of at least 8 bits.
After you change the password, you can do the database operation.

MySQL [email protected]:(none) > show databases;+--------------------+| Database | | --------------------|| Information_schema | | MySQL | | Performance_schema | | SYS |+--------------------+4 rows in settime:0.009s

Next, modify the default password policy (the actual environment is not recommended to be modified to a lower security policy)

MySQL [email protected]:(None) > Set global validate_password_policy = 0; Query OK, 0 rows affectedtime:0.003s

When the default password policy is set, only the password length is limited. The default is a character length of at least 8 bits.


To permanently turn off the password complex security policy, add the following and restart the mysqld in the configuration file:
[Mysqld]
Validate_password=off



Resources:

Website Information Address:

Https://dev.mysql.com/doc/refman/5.6/en/alter-user.html

Initialization of MySQL 5.7

http://professor.blog.51cto.com/996189/1783769



This article is from the "Boyhack" blog, make sure to keep this source http://461205160.blog.51cto.com/274918/1956810

MySQL5.7 Change Password

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.