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

Example of using CSS filter to write mouse over effect

Use CSS filter to write mouse over effect <div...

HTML validate HTML validation

HTML validate refers to HTML validation. It is the...

How to add Lua module to Nginx

Install lua wget http://luajit.org/download/LuaJI...

Display mode of elements in CSS

In CSS, element tags are divided into two categor...

innodb_flush_method value method (example explanation)

Several typical values ​​of innodb_flush_method f...

Example of implementing QR code scanning effects with CSS3

Online Preview https://jsrun.pro/AafKp/ First loo...

Collection of 12 practical web online tools

1. Favicon.cc To create ico icon websites online,...

mysql uses stored procedures to implement tree node acquisition method

As shown in the figure: Table Data For such a tre...

A simple example of MySQL joint table query

MySql uses joined table queries, which may be dif...

How to solve the 10060 unknow error when Navicat remotely connects to MySQL

Preface: Today I want to remotely connect to MySQ...

Docker solves the problem that the terminal cannot input Chinese

Preface: One day, I built a MySQL service in Dock...