Centos MySQL8 configuration

change Password##

  1. View initial password
grep 'temporary password'/var/log/mysqld.log
  1. Connect to MySQL, enter the following code, press Enter and enter the above password
mysql -uroot -p
  1. Select database
use mysql;
  1. Leave authentication_string blank
update user set authentication_string='' where user='root';

Note: In mysql8.0 and above,

update mysql.user set password='newpassword' where user='root';
 
update mysql.user set password=PASSWORD('newpassword') where User='root';

These two commands no longer work

  1. change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

There will be an error as follows:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

This is actually related to the value of validate_password_policy

The following values are available:

Policy Tests Performe (Required)
0 or LOW Length
1 or MEDIUM numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters

The default is 1, which is MEDIUM, so the password set at the beginning must meet the length, and must contain numbers, lowercase or uppercase letters, and special characters.
Sometimes, I just want to test myself and don’t want the password to be so complicated. For example, I just want to set the root password to 123123.

This is the time, Wimbledon can modify a few global variables when using it to enter the database for the first time, or skip the permission table to enter the database again!

mysql> show variables like "%validate%";+--------------------------------------+--------+| Variable_name                        | Value  |+--------------------------------------+--------+| query_cache_wlock_invalidate         | OFF    || validate_password_check_user_name    | OFF    || validate_password_dictionary_file    ||| validate_password_length             |8|   ##The minimum length of the password, change to 6| validate_password_mixed_case_count   |1|| validate_password_number_count       |1|| validate_password_policy             | MEDIUM |   #Change this to 0, you can accept a simple password
| validate_password_special_char_count |1|+--------------------------------------+--------+
# Modify global variables
mysql>set global validate_password_length=6;
Query OK,0 rows affected(0.00 sec)

mysql>set global  validate_password_policy=0;
Query OK,0 rows affected(0.00 sec)

mysql> show variables like "%validate%";+--------------------------------------+-------+| Variable_name                        | Value |+--------------------------------------+-------+| query_cache_wlock_invalidate         | OFF   || validate_password_check_user_name    | OFF   || validate_password_dictionary_file    ||| validate_password_length             |6|| validate_password_mixed_case_count   |1|| validate_password_number_count       |1|| validate_password_policy             | LOW   || validate_password_special_char_count |1|+--------------------------------------+-------+8 rows inset(0.00 sec)

mysql> alter user 'root'@'localhost' identified by '123123';  #Change the password again, there will be no more mistakes!
Query OK,0 rows affected(0.01 sec)

from:

https://blog.csdn.net/ssiyla/article/details/82931439

https://www.cnblogs.com/mzxiaoze/p/10413399.html

Recommended Posts

Centos MySQL8 configuration
Centos mysql installation and configuration
CentOS7 install MySQL
CentOS7.0 network configuration
CentOS 7.0 network configuration
CentOS install mysql
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS8 install MySQL8.0
CentOS7 install mysql8
CentOS7 install MySQL8
centos 7.5 install mysql5.7.17
Centos7 mysql database installation and configuration
MySQL 8.0 installation, deployment and configuration under CentOS 6/7
Xfs configuration on centos7
CentOS6.5 offline install MySQL5.6.26
Install MySQL5.7 in centos7
Install mysql5.7 under CentOS7
Centos kernel compilation configuration
CentOS 7.2 Yum install MySQL 5.6
Centos7 install Mysql8 tutorial
Centos manually install mysql8
Install mysql under Centos 7
CentOS7 reset MySQL8.0 password
Install mysql5.1 under CentOS6.5
MySQL 8.0 installation, deployment and configuration tutorial on CentOS 8
Install mysql online on centos
CentOS 8 (2)
centos install mysql through yum
Centos7.4 deployment configuration Elasticsearch5.6 cluster
Centos7 installation and configuration prometheus
Install MySQL 8.0.16 on Linux Centos
CentOS 6.x installation mysql5.7 record
CentOS installation and configuration cmake
Install MySQL under Linux (CentOS 7)
CentOS 7 user account configuration original
Centos6 install mysql 5.7.x series
CentOS 8 (1)
Implementation of CentOS8.0 Network Configuration
CentOS 7 Redis 5.0.8 sentinel mode configuration
CentOS8 network card configuration file
CentOS8 install MySQL8 (pro test)
How to install MySQL on CentOS 8
CentOS7 yum install and start mysql
Centos7 installation and configuration of Jenkins
CentOS Yum compile and install MySQL 5.6
CentOS 8 install Git and basic configuration
CentOS 7 install Nginx, PHP, MySQL packages
Centos7 hadoop cluster installation and configuration
CentOS configuration git server in VirtualBox
Install MySql with Docker in CentOS7
Performance comparison of MySQL centos 6 vs 7
CentOS7.2 and Nginx configuration virtual host
Detailed examples of Centos6 network configuration
CentOS7 yum install and start mysql
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos yum install mysql5.6 or above
Java-JDK installation and configuration under CentOS
CentOS 7 Tomcat service installation and configuration
Centos 7 RAID 5 detailed explanation and configuration
CentOS configuration swap exchange area method