Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Centos7 view the default root password?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

CentOS7 installs MariaDB by default. To install mysql 5.7, you need to add mysql official yum source.

1. Download official yum source

First you need to download the official yum source

wget https://repo.mysql.com/mysql57-community-release-el7.rpm2. Install yum source yum -y install mysql57-community-release-el7.rpm3. Install mysql server

Everything is ready to install mysql server

yum -y install mysql-community-server4. start the service

Now start the mysql daemon using systemctl

systemctl start mysqld

Starting mysql for the first time initializes the database, so it takes a while.

5. View root password

Initializing the database sets a default password for root, which can be found in the log file.

The requested URL/log/mysqld.log was not found on this server.

Or you can extract the password directly using the following statement

grep "password is generated" /var/log/mysqld.log | awk '{print $NF}'

After finding the password, you can enter the password into the database with the following command

mysql -uroot -p

The first time you enter the database, you can only change the password. You can't do anything.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';

The new password here cannot be too simple, because mysql has a complexity requirement for passwords by default.

Complexity requirements can be turned off with the following command

mysql> set global validate_password_policy=0; #close password complexity policy mysql> set global validate_password_length=4; #Set the minimum password length to More CentOS related information:

How to change the root password

CentOS7 Forgot Root Password How to do

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report