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 MySQL8 for Centos7

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

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "Centos7 how to install MySQL8", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Centos7 how to install MySQL8" bar!

1: query whether mysql is installed in centos7; if it is installed, uninstall it directly; if it is not installed, start the installation directly.

Command:

Rpm-qa | grep mysql

If installed, the following results will appear

Uninstall: use the following command to remove the installed package.

Yum remove XXX

Remove the installed configuration: use the following command to find the configuration:

Find /-name mysql

The results that may be displayed are as follows: use rm-rf to delete the found configuration.

Check to see if mariadb is installed

Rpm-pa | grep mariadb

If there is an installation, use the following command to remove:

Rpm-e XXXrpm-e-- nodeps xxx / / force deletion

2: install

There is no mysql in centos's yum source by default, so we need to go to the official website to download mysql's repo source and install it.

Address: https://dev.mysql.com/downloads/repo/yum/

Upload the downloaded mysql80-community-release-el7-3.noarch.rpm to Linux

Path eg:

Cd / usr/local/soft mkdir mysql8

Install mysql80-community-release-el7-3.noarch.rpm

Rpm-ivh mysql80-community-release-el7-3.noarch.rpm

Execution result: two files are generated in the / etc/yum.repos.d/ directory:

Update yum command

1: yum clean all2: yum makecache

Install mysql

The following figure indicates that the installation is successful

Join Boot Startup: systemctl enable mysqld.service stop Service: systemctl stop mysqld.service Startup Service: systemctl start mysqld.service View Service status systemctl status mysqld.service restart Service: service mysqld restart

The default firewall for centos7 is firewall

Release port 3306:

Firewall-cmd-- zone=public-- add-port=3306/tcp-- permanentfirewall-cmd-- reload; / / reload configuration

Enable the service: systemctl start mysqld.service

Mysql5.8 has an initial password:

Command: grep "password" / var/log/mysqld.log

Login: mysql-u root-p

Enter the password in the red box above. If there is an error in the following picture, it is a password error. If there is no error, the login will be successful.

Solution to password error in the figure above: cat / var/log/mysqld.log

Find the one that's trapped, and that's the latest password.

Enter: mysql-u root-p

If you enter the password shown above, you can log in successfully.

The password must be changed first, or nothing can be done.

Command: alter user 'root'@'localhost' identified by' your password

When the following error occurs:

At this point, you can set the password a little more complicated.

After changing the password:

Command: show databases

Command use mysql to switch databases

The password field of the user table in version 5. 8 is not password, but authentication_string.

Remote connection: the host of root is localhost and needs to be modified

Flush privileges refresh configuration

Update user set host='%' where user = 'root'; changed to any IP connectable

Modify the encryption so that navicat can connect remotely. Cannot use update, there will be a login failure. Plugin represents the encryption method that needs to be modified to mysql_native_password.

Alter user 'root'@'%' identified with mysql_native_password by' your password

At this point, the navicat can be connected.

Other related modifications

Vi / etc/my.cnf

Interactive_timeout=20

Wait_timeout=20

Sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

Thank you for reading, the above is the content of "how to install MySQL8 in Centos7". After the study of this article, I believe you have a deeper understanding of how to install MySQL8 in Centos7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report