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-server under CentOS7

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

Share

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

This article is about how to install mysql-server under CentOS7. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

In Hive, the Derby database can only have one instance and cannot be run on multiple terminals at the same time, which creates a lot of restraints, so the open source mysql database is used for metadata storage, so it is necessary to install mysql-related services on the master node. (recommended course: MySQL video tutorial)

0. First, use the yum list | grep mysql command to find out whether there is MySQL in the yum source. My query result is as follows

As you can see, there is no shadow of mysql-server. (it is said that there is no mysql in the source of centOS7, but the same version of centOS can directly use yum install mysql-server to install mysql in Aliyun.)

Therefore, you can find the installation source for mysql, as follows:

1. Download the repo source of mysql first

$wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2. Install the source package, that is, the mysql-community-release-el7-5.noarch.rpm package

$sudo rpm-ivh mysql-community-release-el7-5.noarch.rpm

After installing this package, you will get two yum repo sources for mysql:

/ etc/yum.repos.d/mysql-community.repo and

/ etc/yum.repos.d/mysql-community-source.repo .

You can find it under / etc in the root directory.

3. Install mysql

$sudo yum install mysql-server

4. Check whether the mysqld service is enabled at this time

$sudo service mysqld status

As you can see, the mysql service has been started

5. Reset the mysql password

[root@master renyang] # mysqladmin-u root password '123456'

But will report an error:

This error is caused by a password problem and cannot be logged in, so you should bypass password verification and reset the password, so add a line "skip-grant-tables" to the\ etc\ my.cnf file in the root directory to bypass password verification, as follows:

Then restart the mysql service and execute [renyang@master ~] $systemctl restart mysqld.service

6. Enter "mysql" to enter mysql, and then you can change the password through the SQL statement in mysql, and enter the following commands in turn

Mysql > use mysqlmysql > update mysql.user set authentication_string=password ('123456') where user='root';mysql > flush privileges;mysql > quit

7. Re-edit my.cnf to remove what you just added: skip-grant-tables. Then restart MySQL: [renyang@master ~] $systemctl restart mysqld.service

Then you can enter MySQL with a password: [renyang@master ~] $mysql-uroot-p

Thank you for reading! On how to install mysql-server under CentOS7 to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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