基于centos7.9安装mariadb

1.服务其初始化

mariadb安装前服务器配置

2.安装

#1.下载安装包
yum install mariadb mariadb-server

#2.启动
systemctl start mariadb

#3.开机自启动
systemctl enable mariadb

#4.初始化
mysql_secure_installation
#第1步:设定root用户密码。
#第2步:删除匿名帐号。
#第3步:禁止root用户从远程登录。
#第4步:删除test数据库并取消对其的访问权限。
#第5步:刷新授权表,让初始化后的设定立即生效。
[root@mariadb1 ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

#5.放行端口或服务
firewall-cmd --permanent --add-service=mysql

#6.登录
mysql -u root -p

#7.开启远程登录
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'xlgw123456!' WITH GRANT OPTION;

#8.刷新权限
MariaDB [(none)]> flush privileges;

3.远程登录

远程登录链接测试成功

.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
好的,以下是 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 的全部步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值