Ubuntu安装Maridb 10.5版本
以20.04版本为例
Ubutun20.04自带源默认安装的mariadb版本为10.3不符合安装zabbix6.0的要求
打开MariaDB的官方网站:https://mariadb.org/mariadb/all-releases

点击你想要的版本

选好你的系统,Ubuntu 20.04版本,要下载的MariaBD 10.5版本,在选择阿里源
按步骤执行写好源
sudo apt-get install apt-transport-https curl
sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo sh -c "echo 'deb https://mirrors.aliyun.com/mariadb/repo/10.5/ubuntu focal main' >>/etc/apt/sources.list"
更新apt-get,安装mariadb-server版本
sudo apt-get update
sudo apt-get install mariadb-server
不要用-Y命令,好确认你的安装版本是否是目标版本
root@Zabbix-DB:/etc/apt/sources.list.d# sudo apt-get install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfwupdplugin1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mariadb-perl libdbi-perl
libfcgi-perl libhtml-template-perl libmariadb3 libreadline5 libsigsegv2 libterm-readkey-perl
mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server-10.5
mariadb-server-core-10.5 socat
Suggested packages:
gawk-doc libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
libipc-sharedcache-perl mailx mariadb-test
The following NEW packages will be installed:
galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mariadb-perl libdbi-perl
libfcgi-perl libhtml-template-perl libmariadb3 libreadline5 libsigsegv2 libterm-readkey-perl
mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server
mariadb-server-10.5 mariadb-server-core-10.5 socat
0 upgraded, 20 newly installed, 0 to remove and 2 not upgraded.
Need to get 28.9 MB of archives.
After this operation, 224 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
检查版本mysql -V
root@Zabbix-DB:/etc/apt/sources.list.d# mysql -V
mysql Ver 15.1 Distrib 10.5.17-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
检查启动情况
systemctl status mariadb
初始化数据库——配置安全设置
sudo mysql_secure_installation
查看代码
root@Zabbix-DB:~# sudo 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
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none): 输入数据库当前root密码,密码为空:直接回车
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n 是否使用unix_socket认证插件:n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y 是否修改root密码: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 是否移除匿名用户: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] y 是否禁止root远程登录:Y
... Success!
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 移除测试数据: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 重新加载权限?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!
创建初始Zabbix数据库
安装完成后,root账户登录数据库,配置一个用户zabbix,设置密码为password,并配置本地登录权限 localhost 或者 远程登录权限 %
sudo mysql -uroot -p
password
mysq1> create database zabbix character set utf8mb4 collate utf8mb4_bin; #zabbix创建数据库要指定字符集,如果不指定中文会乱码,英文不乱码。
mysql> create user zabbix@'%' identified by 'Qqq1234.0';
mysq1> grant all privileges on zabbix.* to zabbix@'%'; #grant授权 all privileges所有权限 on zabbix表里的.*所有文件,授权给zabbix用户 @'%'远程和本地登录
mysq1> quit;
#如果数据库与zbx,php在一起
grant all privileges on zabbix.* to zabbix@'localhost' identified by 'Qqq1234.0';
#如果数据库与zbx,php不在一起
grant all privileges on zabbix.* to zabbix@'172.16.%'identified by 'Qqq1234.0';
#甚至
grant all privileges on zabbix.* to zabbix@'%'identified by 'Qqq1234.0';
数据库账户基本操作命令
#查询数据库账户
select user, host from mysql.user;
#删除账户 'zabbix'
drop user 'zabbix'@'%';
#查询数据库
show databases;
#删除数据库zabbix;
drop database zabbix;
#修改账户密码
alter user 'zabbix'@'%' identified by 'Qqqq1234.com';
#使用zabbix账户登录
use zabbix
#查看所有的表
show tables;
验证登录:
root@Zabbix-DB:~# mysql -uzabbix -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
| zabbix |
+--------------------+
3 rows in set (0.01 sec)
mysql> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
| valuemap |
| valuemap_mapping |
| widget |
| widget_field |
+----------------------------+
173 rows in set (0.00 sec)
mysql> exit
Bye
root@Zabbix-DB:~#
Ubuntu安装Maridb 10.5版本的更多相关文章
- ubuntu 安装 2.10.x版本的scala
Ubuntu 14.04.1 LTS上默认的scala版本是2.9的,而最新版本的spark-1.3需要最低版本的scala版本为2.10.x,先使用apt-get remove scala将机器上的 ...
- 【NS2】ubuntu安装和同时使用不同版本的ns2(转载)
有时候我们可能会遇到要同时安装两个ns版本的问题,比如我研究wimax/802.16,因为协议太复杂,用的是长庚大学和nist的wimax补丁.长庚大学的wimax补丁是在ns2.29下开发的,nis ...
- 【Android 应用开发】 Ubuntu 安装 Android Studio (旧版本|仅作参考)
. 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...
- ceph学习笔记之十二 Ubuntu安装部署Ceph J版本
https://cloud.tencent.com/info/2b70340c72d893c30f5e124e89c346cd.html 安装Ubuntu系统安装步骤略过 拓扑连接: 一.安装前准备工 ...
- ubuntu安装多个qt版本--不同qt版本编译同一个程序时出现错误--解决方案
方法: 在ubuntu终端: # make clean //有Makefile文件的情况 # rm Makefile *.pro.user # qmake //有多个qt版本,最好指定qmake ...
- ubuntu安装kernel3.10.34
参考http://www.linuxidc.com/Linux/2014-03/98818.htm 32位系统安装 wget kernel.ubuntu.com/~kernel-ppa/mainlin ...
- 安装confluence5.10.0版本
1.confluence也是atlassian公司的一应用 2.安装步骤和jira类似 3.破解jar 将/export/atlassian/confluence/confluence/WEB-INF ...
- ubuntu安装gcc不同的版本
服务器ubuntu14.04安装ns3.29中,显示gcc版本过低 使用apt-get安装失败,ubuntu14.04默认安装gcc4.8.4,无法下载更高级的gcc版本 先找到资料1,脚本尝试了,下 ...
- Ubuntu安装pyucharm的专业版本
看到了不错的教程,亲测有效. https://www.cnblogs.com/huozf/p/9304396.html
- Ubuntu Server 13.10 安装配置图解教程
一.Ubuntu Server 13.10系统安装 Ubuntu分为桌面版(desktop)和服务器版(Server),下面为大家介绍服务器版本Ubuntu Server 13.10的详细安装过程. ...
随机推荐
- 删除软件 geek
下载链接 Geek Uninstaller_v1.5.1.162 -技术松鼠 (jishusongshu.com)
- 一种对数据库友好的GUID的变种使用方法
概述 .NET生成的GUID唯一性很好,用之方便,但是,缺少像雪花算法那样的有序性.虽然分布式系统中做不到绝对的有序,但是,相对的有序对于目前数据库而言,索引效率等方面的提升还是有明显效果的(当然,我 ...
- Redis系列之——API的使用
文章目录 一 通用命令 1.1 通用命令 1.2 数据结构和内部编码 1.3 单线程架构 1.3.1 单线程架构, 1.3.2 单线程为什么这么快 1.3.3 注意 二 字符串类型 2.1 字符串键值 ...
- Kbaor_2023_9_28_Java第一次实战项目_ELM_V1_食品的实体类、工具类与实现类
Kbaor_2023_9_28_Java第一次实战项目_ELM_V1_食品的实体类.工具类与实现类 ELM_V1_食品的实体类 package elm_V1; /** * [食品实体类] * * @a ...
- 解密长短时记忆网络(LSTM):从理论到PyTorch实战演示
本文深入探讨了长短时记忆网络(LSTM)的核心概念.结构与数学原理,对LSTM与GRU的差异进行了对比,并通过逻辑分析阐述了LSTM的工作原理.文章还详细演示了如何使用PyTorch构建和训练LSTM ...
- 树莓派4B使用串口登录的设置方法
-特别提示- 本文具有时效性. 当前我使用的是pi4硬件, 镜像版本 raspberrypi 5.15.61 32位. 在我解决该问题的时候, 在网上查找了很多方法, 有些方法被实际测试发现是不行的. ...
- centos7安装glibc_2.28和gcc 8.2
centos7默认的gcc版本是4.8.5,无法编译高版本的glibc 2.28,需要升级到gcc 8.2版本 注:gcc高版本和glibc 2.28不兼容 ## 查看自带默认的glibc strin ...
- Java JDBC连接数据库的CURD操作(JDK1.8 + MySQL8.0.33 + mysql-connector-java-8.0.27-bin驱动)
JDBC概述 JDBC(Java Database Connectivity)是一个独立于特定数据库管理系统.通用的SQL数据库存取和操作的公共接口(一组API),定义了用来访问数据库的标准Java类 ...
- 🔥🔥Java开发者的Python快速进修指南:迭代器(Iterator)与生成器
这一篇内容可能相对较少,但是迭代器在Java中是有用处的.因此,我想介绍一下Python中迭代器的使用方法.除了写法简单之外,Python的迭代器还有一个最大的不同之处,就是无法直接判断是否还有下一个 ...
- MySQL的索引为什么使用B+树而不使用跳表?
目录 MySQL的索引为什么使用B+树而不使用跳表? 1.B+树的结构 2.跳表的结构 3.B+树和跳表的区别 1.B+树新增数据会怎么样 跳表新增数据 4.Mysql的索引为什么使用B+树而不使用跳 ...