CentOS install MySQL and configure initial password

Source: Internet
Author: User

MySQL website yum installation tutorial, Address: https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/#repo-qg-yum-fresh-install

One, MySQL download installation

Download the MySQL rpm file first: https://dev.mysql.com/downloads/repo/yum/

Uploading to the/home directory using the upload command, such as the RZ command (yum install-y lrzsz)

  

Add a MySQL repository (-UVH followed by the rpm file you downloaded)

sudo rpm-uvh mysql57-community-release-el7-11.noarch.rpm

Install MySQL

sudo yum install-y mysql-community-server

Start the MySQL service

Or

sudo systemctl start Mysqld.service

Second , the password configuration

The new version of MySQL creates an initial password for the root user and needs to be changed.

View the default password

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

Use this initial password to log in to MySQL

Mysql-uroot-peejvy2mlgs+e

Fixed password strength Check rule (used for test environment), the high version of MySQL will restrict the creation of simple password when changing password, if it is only for testing, it can modify his password detection policy:

Modify: Password Minimum length policy

MySQL>set global validate_password_length=0;

Modified: Password strength check level policy, 0/low, 1/medium, 2/strong

MySQL>set global validate_password_policy=0;

Change Password

MySQL>setfor'root'@'localhost'  = password ('root123');

Second , other configuration

Open MySQL root user remote Connection service (% number is remote connection, identified by followed by password)

MySQL>GRANTallprivilegeson*. *  to ' Root '@ '%' by'root123'  withGRANTOPTION;

Refresh

MySQL>privileges;

Turn on the MySQL port service

/sbin/iptables-i input-p TCP--dport 3306-J Acceptservice Network Restart

CentOS install MySQL and configure initial password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.