MySQL Installation of Yum installation

Source: Internet
Author: User

MARIADB is installed by default in CentOS7, this is the branch of MySQL, but in order to need it, it is necessary to install MySQL in the system, and after the installation is complete, you can overwrite the mariadb directly.

1. Download and install the official MySQL Yum Repository
[Email protected]/]# Wget-i-C http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

Use the command above to download the installation of Yum Repository, about 25KB, then you can directly install Yum.

Here's how to install MySQL with yum.

[Email protected]/]# yum-y install Mysql-community-server

This step may take some time, and the previous mariadb will be overwritten when the installation is complete.

This prompt indicates that the installation was successful

2. mysql Database settings

Start MySQL First

[Email protected]/]# systemctl start  mysqld.service

View MySQL running status, running status

[Email protected]/]# systemctl status Mysqld.service

At this point, MySQL has started to run normally, but to get into MySQL also need to find the root user's password, the following command can be found in the log file password:

[[email protected]/]# grep "Password"/var/log/mysqld.log

It's marked with the initial password.

Enter the database as follows:

[[email protected]/]# mysql-uroot-p     # will prompt for password after enter

Enter the initial password and you can't do anything at this time, because MySQL must change the password before you can manipulate the database:

Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' new password ';

Here is a question, if the setting of the new password is too simple to error:

The reason for this is that MySQL has a password-setting specification, specifically related to the value of Validate_password_policy:

MySQL complete initial password rules can be viewed by the following commands:

mysql> SHOW VARIABLES like ' validate_password% '; +--------------------------------------+-------+| Variable_name                        | Value |+--------------------------------------+-------+| Validate_password_check_user_name    | OFF   | | validate_password_dictionary_file    |       | | validate_password_length             | 4     | | validate_ Password_mixed_case_count   | 1     | | validate_password_number_count       | 1     | | validate_password_policy             | Low   | | validate_password_special_char_count | 1     |+--------------------------------------+-------+rows in Set (0.01 sec)

The length of the password is determined by validate_password_length, while the Validate_password_length formula is:

Validate_password_length = Validate_password_number_count + Validate_password_special_char_count + (2 * validate_ Password_mixed_case_count)

The workaround is to change the password to a code that is complex:

At this time we have to change the password rules, execute the following SQL can be:

After the setting is I found above the values, at this time the password can be set up very simple, such as 1234. The password settings to this database are complete.

But at this point, there is a problem, because the Yum Repository is installed, each time the Yum operation will be automatically updated, you need to uninstall this:

[Email protected] ~]# yum-y Remove Mysql57-community-release-el7-10.noarch

Configuration is complete.

Login Authorization for Visualizer:

Operation completed above, and now can not be connected with a visual client, we need to authorize:

Grant all on * * to [e-mail protected] '% ' identified by ' database password ';

Done!!!

MySQL Installation of Yum installation

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.