Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install mysql 8.0 in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to install mysql 8.0 in the Linux system. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.

Preparatory work:

Mysql8.0 rpm file

Testing tools (such as idea's database tool)

Installation steps:

1. Download the repo source for mysql at:

Enter the Linux system and enter the instructions:

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

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

Input instruction: sudo rpm-ivh mysql80-community-release-el7-1.noarch.rpm

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

3. Install mysql

Input instruction: sudo yum install mysql-server

It is OK to install according to the prompts, but there is no password after the installation is completed, so you need to reset the password.

4. It is possible to report such an error when logging in: ERROR2002 (HY000): Can't connect to local MySQL server through socket'/ var/lib/mysql/mysql.sock' (2) due to access to / var/lib/mysql. The following command changes the owner of / var/lib/mysql to the current user:

Input instruction: mysql-u root

Input instruction: sudo chown-R root:root / var/lib/mysql

Input instruction: service mysqld restart

After the re-completion, you can see the following after typing mysql-u root, but now remind you of the wrong password and enter the instruction to get the random password.

Generate random passwords

Input instruction: grep 'temporary password' / var/log/mysqld.log

I reported this error when I went to query the user: You must reset your password using ALTER USER statement beforeexecuting this statement

Before executing this statement, you must use the ALTE USER statement to reset the password.

Then I perform the operation of changing the password:

Report again: Your password does not satisfy the current policy requirements

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 here. I don't know if it's available. I use a complex password.)

Remote connection

1. Change the meter and send it.

It may be that your account is not allowed to log in remotely, only in localhost. At this time, just log in to mysql on the computer in localhost and change the "host" entry 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, if you want myuser to connect to the mysql server from any host using mypassword.

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

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

Here I use the change table hair, the implementation of the authorization law has been reporting errors, I do not know if it is because of my MySQL8.0.

Then restart the service: service mysqld restart

The above is the editor for you to share how to install mysql 8.0 in the Linux system, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report