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

MySQL installation and initial password modification

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MySQL installation

I. system environment

Centos7 or REHL7

Download the MySQL rpm installation package (here, take 5.7 as an example)

There is no need to say much about the specific download methods, there are many on the Internet.

Delete the MariaDB database that comes with the system.

Rpm-qa | grep-I mariadb

Rpm-e-nodeps mariadb-libs

Rm-rf / etc/my.cnf

Fourth, install related dependency packages

Yum-y install perl-Data-Dumper.x86_64 perl-JSON

Upgrade and install MySQL

Tar-xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

Rm-rf mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm # remove minimum installation

Rpm-Uvh mysql-community-*.rpm

Systemctl start mysqld

Systemctl enable mysqld

Systemctl status mysqld

All right, the installation of MySQL is complete here. Additional information such as the process port of MySQL is attached:

Service name: mysqld

Process name: mysqld

Master / group of the process: mysql/mysql

Port number: TCP/3306

Main profile location: / etc/my.cnf

Database directory location: / var/lib/mysql

Initial MySQL login password modification

First, view the log file

Grep-I "password" / var/log/mysqld.log

You can see that there is a string of characters and passwords. Copy them down.

Log in to MySQL with the password found

Mysql-hlocalhost-uroot-p "Y1jNtb50Hd+x" # Note here: use single quotation marks if there is a special symbol.

Change the temporary password

Mysql > set global validate_password_policy=0

Mysql > set global validate_password_length=6

Mysql > alter user root@ "localhost" identified by "123456"

Mysql-hlocalhost-uroot-p123456 # re-log in to the database with the changed password

Mysql > show databases; # can see the concrete library

IV. Permanent password policy: modify the configuration file

Vim / etc/my.cnf

[mysqld]

Validate_password_policy=0

Validate_password_length=6

Systemctl restart mysqld # restart the service

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

Database

Wechat

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

12
Report