Detailed tutorial on installing mysql8.0.22 on Alibaba Cloud centos7

Detailed tutorial on installing mysql8.0.22 on Alibaba Cloud centos7

1. Download the MySQL installation package

First click https://dev.mysql.com/downloads/repo/yum/

Find the Linux7 version;
The latest version of mysql will be automatically downloaded here. I have mysql8.0.22

Then go to splice URL:
http://dev.mysql.com/get/ + xxx.rpm
For example, mine is http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

So the command:

[root@hadoop ~]# rpm -ivh http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

2. Install MySQL

yum install -y mysql-server
Or (I only installed the previous one and the next one was automatically installed)
yum install mysql-community-server

If the following is displayed, the installation is successful
Complete!

3. Set up MYSQL

  • Set up Mysql startup [root@localhost ~]# systemctl enable mysqld.service
  • Check whether the startup autostart is installed

[root@localhost ~]# systemctl list-unit-files | grep mysqld

If the following content is displayed, the automatic startup installation has been completed
mysqld.service enabled

  • Set up service

[root@localhost ~]# systemctl start mysqld.service

The password modification method of MySQL 8.0 version is different from that of previous versions:
4. Log in to modify the MySQL password and view the MySQL default password

mysql> alter user 'root'@'localhost' identified by 'new password';

As shown in the picture, my initial password is #XIWpa5A>D)(

Log in to MySQL for the first time and enter the account and default password
[root@localhost ~]# mysql -uroot -p
Modify current password

#MySQL8.0 requires a combination of uppercase and lowercase letters, numbers, and special characters to modify the password

mysql> alter user 'root'@'localhost' identified by 'new password';

It is recommended to use a stronger password here, otherwise there is still a risk! In short, don't set the password too easily! But you still have to remember the password yourself.

Note when setting a password:

insert image description here

insert image description here

5. The command is executed immediately and takes effect

mysql>flush privileges;

Use external network/client access, such as navicat connection

Solution: Log in to MySQL and modify the host of the user logged in in the user table

#Remotely set mysql> use mysql;
mysql> select host,user from user;
±---------±-----------------+
| host | user |
±---------±-----------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
±---------±-----------------+
4 rows in set (0.00 sec)

You can see the root user that has been created in the user table. The host field indicates the host you are logging in to. Its value can be either IP or host name. If you want to log in using the local IP, you can change the above Host value to your own IP .

Changing the value of the host field to % means that you can log in to the MySQL server as the root user on any client machine. It is recommended to set it to % during development.

mysql > update user set host = '%' where user = 'root';

Change the permissions to ALL PRIVILEGES (I didn't do this step)
Authorize the user name to grant any host access to the data

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Remember to refresh:

mysql> FLUSH PRIVILEGES;

Later, modify the security group rules of Alibaba Cloud: In the Alibaba Cloud console firewall, add a new rule to open port 3306:

Sequence: Alibaba Cloud Console –> (Recommended) Add cloud server ECS in the common navigation and click —> Then click Instance ----> Click Security Group (create a new security group if there is none) –> Configure rules – then you can add it

Now you can connect using navicat.

1. Turn off the firewall:

sudo systemctl stop firewalld.service

2. Turn off the startup:

sudo systemctl disable firewalld.service

3. Check the firewall status

systemctl status firewalld

4. Open the firewall

systemctl start firewalld

Database related operations

Query the rpm package of mysql

rpm -qa | grep mysql

Start mysql

systemctl start mysqld.service

stop

systemctl stop mysqld.service

Restart

systemctl restart mysqld.service

Automatic startup

systemctl enable mysqld.service

Check the status of mysql: (two types)

service mysqld status
systemctl status mysqld.service

MySQL security configuration

mysql_secure_installation

Security settings include:

  1. Set a password for the root user
  2. Delete anonymous accounts (recommended for production environments)
  3. Disable remote login for root user
  4. Delete the test library and access permissions to the test library (delete)
  5. Refresh the authorization table to make the changes take effect

This is the end of this article about the detailed tutorial on how to install mysql8.0.22 on Alibaba Cloud CentOS7. For more information about how to install mysql8 on Alibaba Cloud CentOS7, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • MySQL 8.0.22 decompression version installation tutorial (for beginners only)
  • Super detailed MySQL8.0.22 installation and configuration tutorial
  • Detailed tutorial for installing MySQL 8.0.22 on Redhat 7.3 (binary installation)

<<:  Analysis of Docker's method for creating local images

>>:  Docker image management common operation code examples

Recommend

How to submit the value of a disabled form field in a form Example code

If a form field in a form is set to disabled, the ...

Mini Program to Implement the Complete Shopping Cart

The mini program implements a complete shopping c...

How to change the MySQL database file directory in Ubuntu

Preface The company's Ubuntu server places th...

Solution to the problem of insufficient storage resource pool of Docker server

Table of contents 1. Problem Description 2. Probl...

JS quickly master ES6 class usage

1. How to construct? Let's review the common ...

Solve the problem of specifying udp port number in docker

When Docker starts a container, it specifies the ...

Pure CSS to achieve automatic rotation effect of carousel banner

Without further ado, let’s get straight to the co...

Win7 installation MySQL 5.6 tutorial diagram

Table of contents 1. Download 2. Installation 3. ...

CentOS6.8 Chinese/English environment switching tutorial diagram

1. Introduction People who are not used to Englis...

How to use Cron Jobs to execute PHP regularly under Cpanel

Open the cpanel management backend, under the &qu...

How to make an input text box change length according to its content

First: Copy code The code is as follows: <input...