进入mariadb_Centos7.9安装Mariadb数据库

MariaDB 数据库管理系统是 MySQL 的一个分支,主要由开源社区在维护,采用 GPL 授权许可。开发这个分支的原因之一是:甲骨文公司收购了 MySQL 后,有将 MySQL 闭源的潜在风险,因此社区采用分支的方式来避开这个风险。MariaDB完全兼容mysql。

480f15415acefcc5648d9b335b76d881.png

系统环境:Centos7.9

[root@localhost /]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)

一、安装MariaDB

通过yum安装就行了。简单快捷,安装mariadb-server,默认依赖安装mariadb,一个是服务端、一个是客户端。

[root@localhost ~]# yum install mariadb-server

二、配置MariaDB

1、安装完成后首先要把MariaDB服务开启,并设置为开机启动

[root@localhost ~]# systemctl start mariadb  # 开启服务[root@localhost ~]# systemctl enable mariadb  # 设置为开机自启动服务

2、首次安装需要进行数据库的配置,命令都和mysql的一样

[root@localhost ~]# mysql_secure_installation

 3、配置时出现的各个选项

Enter current password for root (enter for none):  # 输入数据库超级管理员root的密码(注意不是系统root的密码),第一次进入还没有设置密码则直接回车Set root password? [Y/n]  # 设置密码,yNew password:  # 新密码Re-enter new password:  # 再次输入密码Remove anonymous users? [Y/n]  # 移除匿名用户, yDisallow root login remotely? [Y/n]  # 拒绝root远程登录,n,不管y/n,都会拒绝root远程登录Remove test database and access to it? [Y/n]  # 删除test数据库,y:删除。n:不删除,数据库中会有一个test数据库,一般不需要Reload privilege tables now? [Y/n]  # 重新加载权限表,y。或者重启服务

4、测试是否能够登录成功,出现  MariaDB [(none)]> 就表示已经能够正常登录使用MariaDB数据库了

[root@localhost ~]# mysql -u root -p

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 8

Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

三、防火墙设置

1、关闭防火墙命令

[root@localhost ~]# systemctl stop firewalld

2、在不关闭防火墙的情况下,允许某端口的外来链接。步骤如下,开启3306端口,重启防火墙

[root@localhost ~]# firewall-cmd --query-port=3306/tcp  # 查看3306端口是否开启[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent  # 开启3306端口[root@localhost ~]# firewall-cmd --reload  # 重启防火墙

四、开启root远程访问

[root@localhost ~]# mysql -u root -p  # 先通过本地链接进入数据库MariaDB [(none)]> use mysql;

将与主机名相等的字段改为 "%" ,我的主机名为localhost,

MariaDB [mysql]> update user set host='%' where host='localhost';

刷新权限表,或重启mariadb服务,二选一即可

MariaDB [mysql]> flush privileges;[root@localhost ~]# systemctl restart mariadb

卸载数据库命令:

[root@localhost ~] yum remove mariadb-server
  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是 CentOS 7.9 安装 Zabbix 的步骤: 1. 安装 EPEL 和 Zabbix 仓库 ```shell yum install -y epel-release rpm -ivh https://repo.zabbix.com/zabbix/5.2/rhel/7/x86_64/zabbix-release-5.2-1.el7.noarch.rpm ``` 2. 安装 Zabbix Server、Zabbix Agent 和 Zabbix Web ```shell yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent ``` 3. 安装 MySQL 数据库 ```shell yum install -y mariadb mariadb-server ``` 4. 配置 MySQL 数据库 ```shell systemctl start mariadb systemctl enable mariadb mysql_secure_installation ``` 5. 创建 Zabbix 数据库 ```shell mysql -uroot -p create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; quit; ``` 6. 导入 Zabbix 数据库 ```shell zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix ``` 7. 配置 Zabbix Server 编辑 `/etc/zabbix/zabbix_server.conf` 文件,修改以下参数: ```conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix ``` 8. 配置 Zabbix Web 编辑 `/etc/zabbix/web/zabbix.conf.php` 文件,修改以下参数: ```php $DB['TYPE'] = 'MYSQL'; $DB['SERVER'] = 'localhost'; $DB['PORT'] = '0'; $DB['DATABASE'] = 'zabbix'; $DB['USER'] = 'zabbix'; $DB['PASSWORD'] = 'zabbix'; ``` 9. 启动 Zabbix Server 和 Zabbix Agent ```shell systemctl start zabbix-server systemctl start zabbix-agent systemctl enable zabbix-server systemctl enable zabbix-agent ``` 10. 配置防火墙 ```shell firewall-cmd --add-port=10050/tcp --permanent firewall-cmd --add-port=10051/tcp --permanent firewall-cmd --reload ``` 11. 访问 Zabbix Web 在浏览器中访问 `http://your_ip_address/zabbix`,输入默认用户名 `Admin` 和默认密码 `zabbix` 登录 Zabbix Web。 以上就是 CentOS 7.9 安装 Zabbix 的全部步骤。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值