How to install and modify the initial password of mysql5.7.18 under Centos7.3

How to install and modify the initial password of mysql5.7.18 under Centos7.3

This article shares with you the installation of mysql5.7.18 under Centos7.3 and the modification of the initial password for your reference. The specific contents are as follows

1. Official installation documentation

http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

2. Download the MySQL yum package

http://dev.mysql.com/downloads/repo/yum/

Download to local and then upload to the server, or use wget to download directly

wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

3. Install the software source

Replace platform-and-version-specific-package-name with the name of the rpm you downloaded

sudo rpm -Uvh platform-and-version-specific-package-name.rpm

For example

rpm -Uvh mysql57-community-release-el7-10.noarch.rpm 


4. Install MySQL server

yum install -y mysql-community-server

If the network environment is not very good, you can go make a cup of tea or play a glory kill after executing the command.

5. Start mysql

service mysqld start
systemctl start mysqld.service

6. Check the running status of mysql

service mysqld status
systemctl status mysqld.service

7. Change temporary password

After Mysql5.7 is installed by default, root has a password.

7.1 Get the temporary password of MySQL

To enhance security, MySQL 5.7 randomly generates a password for the root user. In the error log, the location of the error log, if the RPM package is installed, is /var/log/mysqld.log by default.
Only after starting MySQL once can you view the temporary password

grep 'temporary password' /var/log/mysqld.log


The password here is YdsGaxOq>2n!

7.2 Login and change password

Log in using the default password

mysql -uroot -p

After logging in to the server with this password, you must change the password immediately, otherwise the following error will be reported:

mysql> select @@log_error;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>

Change Password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

If the password is too simple, the following prompt will appear


How to solve ERROR 1819 (HY000): Your password does not satisfy the current policy requirements ? The solution is provided directly here. Detailed instructions are given at the end of the article.

Two global parameters must be modified:
First, modify the value of the validate_password_policy parameter

mysql> set global validate_password_policy=0;

Change the password length

set global validate_password_length=1;

Just execute the change password again

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';

8. Authorize other machines to log in

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; FLUSH PRIVILEGES

9. Detailed instructions on password setting

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

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.6 installation tutorials for various versions

MySQL 5.7 installation tutorials for various versions

mysql8.0 installation tutorials for various versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to quickly modify the root password under CentOS8
  • CentOS 7 set grub password and single user login example code
  • How to change the password of mysql5.7.20 under linux CentOS 7.4
  • How to reset the root password in CentOS7
  • How to modify the root password of MySQL in CentOS environment
  • Solution to the problem of still having to enter a password after configuring ssh password-free login in centos
  • How to change mysql password under Centos
  • CentOS 7 Forgot Password Solution Process Diagram

<<:  Docker container deployment attempt - multi-container communication (node+mongoDB+nginx)

>>:  Global call implementation of Vue2.x Picker on mobile terminal

Recommend

MySQL 5.7.18 installation tutorial and problem summary

MySQL 5.7.18 installation and problem summary. I ...

Summary of some common methods of JavaScript array

Table of contents 1. How to create an array in Ja...

The latest MySQL 5.7.23 installation and configuration graphic tutorial

The detailed installation and configuration of th...

Tutorial on deploying springboot package in linux environment using docker

Because springboot has a built-in tomcat server, ...

A set of code based on Vue-cli supports multiple projects

Table of contents Application Scenario Ideas Proj...

Getting Started with Nginx Reverse Proxy

Table of contents Overview The role of reverse pr...

About the use of Vue v-on directive

Table of contents 1. Listening for events 2. Pass...

CSS3 border effects

What is CSS# CSS (abbreviation of Cascading Style...

MySQL uses binlog logs to implement data recovery

MySQL binlog is a very important log in MySQL log...

Steps to restore code from a Docker container image

Sometimes the code is lost and you need to recove...

Detailed explanation of the execution process of MySQL query statements

Table of contents 1. Communication method between...

Pure HTML and CSS to achieve JD carousel effect

The JD carousel was implemented using pure HTML a...

How to allow remote connection in MySql

How to allow remote connection in MySql To achiev...