CentOS Install MySQL

Source: Internet
Author: User
Tags builtin routeros

1. Download the MySQL repo source

$ wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

2. Install the MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM package

$ sudo rpm-ivh mysql57-community-release-el7-8.noarch.rpm

After installing this package, you will get two MySQL yum repo Source:/etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo.

3. Install MySQL

$ sudo yum install Mysql-server

Follow the prompts to install, but there is no password after installation, you need to reset the password

4. Reset MySQL Password

$ mysql-u Root

This error may be reported at login: Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2) because/var /lib/mysql access rights issues. The following command changes the owner of the/var/lib/mysql to the current user:

$ sudo chown-r root:root/var/lib/mysql

Restart MySQL Service

$ Service Mysqld Restart

Next login to reset Password:

‘temporary password‘ /var/log/mysqld.log(如果之前安装过MySQL则这里可能会有多个密码,用最后一个,注意这个密码输入时是可以粘贴的)

Log in using the default password

mysql -uroot -p(这是一个MySQL的以密码登录root用户的命令)

After logging on to the server with this password, you must modify the password and perform some database operations immediately, or you will get the following error:

mysql> select @@log_error;ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.mysql>

Change the password (note that it is best to have a post-logon operation; end)

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘root123‘;

If the password settings are too simple, the following prompt appears


How to solve ERROR 1819 (HY000): Your password does not satisfy the current policy requirements it? The solution is provided directly at the end of this article with detailed instructions

Two global parameters must be modified:
First, modify the value of the Validate_password_policy parameter

set global validate_password_policy=0;

Change the length of the password again

set global validate_password_length=1;

Execute the change password again.

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘root123‘;(ALTER等可以写成小写)

CentOS Install MySQL

Related Article

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.