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 in CentOS7YUM

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

How to install mysql in CentOS7 YUM, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

1. Download YUM repository files

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

2. Install the YUM Repo file

# yum localinstall mysql80-community-release-el7-1.noarch.rpm

3. Select a specific version

5.5 5.6 5.7 8.0

/ / View YUM Warehouse list of all warehouses on MySQL

# yum repolist all | grep mysql

/ / View only enabled

# yum repolist enabled | grep mysql

/ / install the YUM Administration Toolkit, which provides yum-config-manager command tools

# yum install yum-utils

/ / disable 8.0

# yum-config-manager-disable mysql80-community

/ / enable 5.5

# yum-config-manager-enable mysql55-community

Reconfirm the enabled MySQL warehouse

# yum repolist enabled | grep mysql

4. Start installing MySQL

# yum install-y mysql-community-server

5. Manage MySQL services

/ / start

# systemctl start mysqld.service

/ / View status

# systemctl status mysqld.service

/ / Boot self-boot

# systemctl enable mysqld.server

/ / View listening port. Default is 3306.

# ss-natl | grep 3306

6. Open mysql

# mysql

7. Change the password of the root user

Method 1: use the SET PASSWORD command

Log in to MySQL first.

Format: mysql > set password for username @ localhost = password ('new password')

Example: mysql > set password for root@localhost = password ('123')

Method 2: use mysqladmin

Format: mysqladmin-u username-p old password password new password

Example: mysqladmin-uroot-p123456 password 123

Method 3: edit the user table directly with UPDATE

Log in to MySQL first.

Mysql > use mysql

Mysql > update user set password=password ('123') where user='root' and host='localhost'

Mysql > flush privileges

8. The solution that Mysql can not connect remotely in CENTOS7

(1) Log in to MySQL on the machine with MySQL installed. Mysql-u root-p password

(2) execute use mysql

(3) an error may be reported after executing the sentence update user set host ='% 'where user =' root';, regardless of it.

(4) execute FLUSH PRIVILEGES

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Wechat

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

12
Report