MySQL 8.0 installation tutorial under Linux

MySQL 8.0 installation tutorial under Linux

This article introduces how to install MySQL 8.0 under Linux for your reference. The specific contents are as follows

Preparation:

mysql8.0 rpm file

Testing tools (such as IDEA's database tool)

Installation steps:

1. Download the mysql repo source, download address:

Enter the Linux system and enter the command:

wgethttps://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

2. Install the mysql-community-release-el7-5.noarch.rpm package

Enter the command: sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm

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

3. Install MySQL

Enter the command: sudo yum install mysql-server

Just follow the prompts to install it, but there is no password after the installation, you need to reset the password

4. When logging in, the following error may be reported: ERROR2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2). The reason is the access permission problem of /var/lib/mysql. The following command changes the owner of /var/lib/mysql to the current user:

Enter the command: mysql -u root

Enter the command: sudo chown -R root:root /var/lib/mysql

Enter the command: service mysqld restart

After the restart is completed, enter mysql -u root and you can see the following, but now it prompts that the password is wrong. Enter the command to get a random password

Generate a random password

Enter the command: grep 'temporary password' /var/log/mysqld.log

When I go to query the user , I get this error: You must reset your password using ALTER USER statement before executing this statement

This means that before executing this statement, you must use the ALTE USER statement to reset your password.

Then I change the password:

Another report: Your password does not satisfy the current policy requirements

Basically, your password does not meet the current policy requirements.

Note: If you only want to set a simple password, you need to modify two global parameters:

mysql> set globalvalidate_password_policy=0;
mysql> set globalvalidate_password_length=1;

(I haven't tried it here, so I don't know if it works. I used a complex password)

remote connection

1. Modify the form and send it.

Maybe your account does not allow you to log in remotely, only on localhost. At this time, just log in to mysql on the localhost computer and change the "host" item in the "user" table in the "mysql" database from "localhost" to "%"

mysql -u root -pvmwaremysql>use mysql; 
mysql>update user set host = '%' where user = 'root'; 
mysql>select host, user from user;

2. Authorization Law

For example, you want myuser to use mypassword to connect to the mysql server from any host.

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH
  GRANT OPTION; 
FLUSH PRIVILEGES;

If you want to allow user myuser to connect to mysql server from host with ip 192.168.1.6 and use mypassword as password

Here I used the table modification method, and the execution authorization method kept reporting an error. I don’t know if it was because of my MySQL 8.0.

Then restart the service: service mysqld restart

Here I am using a database tool that comes with idea to test the connection, and the connection is successful.

At this point, the entire MySQL 8.0 installation is complete.

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.7 installation tutorials for various versions

MySQL 5.6 installation tutorials for various versions

mysql8.0 installation tutorials for various versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to install MySQL on Ubuntu 18.04 (linux)
  • Detailed tutorial on the free installation version of MySQL 5.7.18 on Linux
  • MySQL 5.6.28 installation and configuration tutorial under Linux (Ubuntu)
  • Diagram of the process from uninstallation to installation of MySQL 5.7.18 yum under Linux
  • Detailed tutorial on installing MySQL 5.7.17 on Oracle Linux 6.8
  • Detailed tutorial on how to install MySQL 5.7.18 in Linux (CentOS 7) using YUM
  • Install MySQL 5.7 on Ubuntu 18.04
  • Detailed tutorial on how to install mysql8.0 using Linux yum command
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • Complete steps to install MySQL 8.0.x on Linux

<<:  4 ways to implement routing transition effects in Vue

>>:  How to set Nginx to forward the domain name to the specified port

Recommend

Simple steps to implement H5 WeChat public account authorization

Preface Yesterday, there was a project that requi...

CSS syntax for table borders

<br /> CSS syntax for table borders The spec...

Introduction to MySQL overall architecture

The overall architecture of MySQL is divided into...

Detailed tutorial for installing ffmpeg under Linux

1. Install ffmpeg under centos linux 1. Download ...

Start a local Kubernetes environment using kind and Docker

introduce Have you ever spent a whole day trying ...

Detailed process record of nginx installation and configuration

Table of contents 1 Introduction to nginx 1 What ...

Detailed explanation of root directory settings in nginx.conf

There are always some problems when configuring n...

Five guidelines to help you write maintainable CSS code

1. Add a comment block at the beginning of the sty...

Vue local component data sharing Vue.observable() usage

As components become more detailed, you will enco...

A very detailed summary of communication between Vue components

Table of contents Preface 1. Props, $emit one-way...

Understand the initial use of redux in react in one article

Redux is a data state management plug-in. When us...

Example of how to implement local fuzzy search function in front-end JavaScript

Table of contents 1. Project Prospects 2. Knowled...

100 ways to change the color of an image using CSS (worth collecting)

Preface “When it comes to image processing, we of...

How to install Nginx and configure multiple domain names

Nginx Installation CentOS 6.x yum does not have n...