Steps to install MySQL on CentOS

Source: Internet
Author: User

1. Download the Mysql Yum pack

http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

Download to local and upload to server, or download directly using wget

http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
2. Install the software source

will be platform-and-version-specific-package-name replaced with the RPM name you downloaded

sudo rpm -Uvh platform-and-version-specific-package-name.rpm

For example

rpm -Uvh mysql57-community-release-el7-10.noarch.rpm
3. Install the MySQL server
install  -y  mysql-community-server

4. Start MySQL First
start    重启是restart,
start mysqld.service
5. Then check the running status of MySQL
service mysqld status
systemctl status mysqld.service(也是系统自动输出的,我这边全称是:Redirecting to /bin/systemctl status  mysqld.service)
6. Modify the temporary password to get the temporary password for MySQL
‘temporary password‘ /var/log/mysqld.log(如果之前安装过MySQL则这里可能会有多个密码,用最后一个,注意这个密码输入时是可以粘贴的)
Login and change your password

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 ‘root‘;

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

 

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 ‘root‘;(ALTER等可以写成小写)
 
7. Authorize other machines to log in
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mima‘ WITH GRANT OPTION;FLUSH PRIVILEGES;

Steps to install MySQL on CentOS

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.