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

Explain in detail the method of installing MariaDB 10.2.4 in CentOS7

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The server / client installation package for MySQL is available in CentOS 6 and previous versions, but CentOS 7 has used MariaDB instead of the default MySQL. MariaDB database management system is a branch of MySQL and is mainly maintained by the open source community. The purpose of licensing MariaDB with GPL is to be fully compatible with MySQL, including API and the command line, making it an easy replacement for MySQL.

1. Delete the built-in MySQL/MariaDB

Search for MariaDB existing packages

Use rpm-qa | grep mariadb to search for existing packages in MariaDB. If it exists, use rpm-e-- nodeps mariadb-* to delete all:

[root@master ~] # rpm-qa | grep mariadbmariadb-server-5.5.52-1.el7.x86_64mariadb-libs-5.5.52-1.el7.x86_64 [root@localhost ~] # rpm-e mysql-*

Error: package mysql-* is not installed

1.2.Removing existing MariaDB packages

If it exists, delete it all using yum remove mysql mysql-server mysql-libs compat-mysql51:

[root@master ~] # yum remove mysql mysql-server mysql-libs compat-mysql51 loaded plug-in: fastestmirror, langpacks parameter mysql does not match parameter mysql-server does not match parameter compat-mysql51 does not match dependency is being resolved-- > checking transaction-- > package mariadb-libs.x86_64.1.5.5.52-1.el7 will be deleted-- > processing dependency libmysqlclient.so.18 () (64bit) It is needed by the package perl-DBD-MySQL-4.023-5.el7.x86_64-- > is dealing with dependencies libmysqlclient.so.18 () (64bit), it is needed by the package 2:postfix-2.10.1-6.el7.x86_64-- > it is dealing with dependencies libmysqlclient.so.18 () (64bit), it is needed by the package 1:qt-mysql-4.8.5-13.el7.x86_64. Delete: mariadb-libs.x86_64 1 4.el7 mariadb-server.x86_64 5.5.52-1.el7 is removed as a dependency: akonadi-mysql.x86_64 0v 1.9.2-4.el7 mariadb-server.x86_64 1V 5.5.52-1.el7 perl-DBD-MySQL.x86_64 0v 4.023-5.el7 postfix.x86_64 2v 2.10.1-6.el7 qt-mysql.x86_ 64 1VR 4.8.5-13.el7. Over! [root@master ~] # rpm-qa | grep mariadb [root@master ~] #

2. MariaDB installation

2. Server and Client installation

[root@master ~] # yum-y install MariaDB-server MariaDB-clientLoaded plugins: fastestmirror Langpacks (1x7): epel/7/x86_64/updateinfo... (7Accord 7): pgdg95/7/x86_64/primary_dbLoading mirror speeds from cached hostfileResolving Dependencies-- > Running transaction check...-- > Finished Dependency ResolutionDependencies Resolved==== Package Arch Version====Installing: MariaDB-client x86x64 10.2.4-1.el7.centos MariaDB-server x86x6410.2.4-1.el7 CentosInstalling for dependencies: MariaDB-common x86 MInstalled size 64 10.2.4-1.el7.centos MariaDB-compat x86 Dependent packages 64... Transaction Summary====Install 2 Packages (+ 12 Dependent packages) Total size: 173 MTotal download size: 113 MInstalled size: 731 M.

Complete!

[root@master ~] # systemctl start mariadb [root@master ~] # systemctl enable mariadb [root@master ~] # systemctl restart mariadb [root@master ~] # systemctl stop mariadb.service

[root@master] # mysql-uroot-p123456

[root@master etc] # cat / etc/my.cnf

If there is no server.cnf file in the / etc/my.cnf.d directory, add the above directly under the [mysqld] tag of the / etc/my.cnf file

Init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake [root@master my.cnf.d] # mysql-uroot-p123456 MariaDB [(none)] > show variables like "% character%"; show variables like "% collation%"

MariaDB [(none)] > create user mariadb@localhost identified by '123456MariaDB [(none)] > grant all on *. * to mariadb@localhost identified by' 123456 MariaDB [(none)] > grant all privileges on *. * to mariadb@'%' identified by '123456MariaDB [(none)] > grant all privileges on *. * to mariadb@'master' identified by' 123456 'with grant option;MariaDB [(none)] > use mysql;MariaDB [mysql] > select host,user,password from user

Forget root username and password

First use killall-TERM mysqld to send a kill command to mysqld server to turn off mysqld server (not kill-9). You must be a root user of UNIX or an equivalent user on the SERVER you are running before you can perform this operation

Then / usr/bin/mysqld_safe-- skip-grant-tables-- skip-networking &

Login: mysql-p or log in without a password using mysql

Use mysqlupdate user set password=password ("new_pass") where user= "root"; flush privileges;exit

Restart the database after the modification is completed, and then log in with the modified root password.

Summary

The above is the editor to introduce to you the method of installing CentOS7 MariaDB 10.2.4, I hope it will be helpful to you, if you have any questions, please leave a message for me, the editor will reply you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

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

Servers

Wechat

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

12
Report