Ubuntu下安装MariaDB

Ubuntu下Mariadb安装配置 安装Mariadb sudo apt update sudo apt install mariadb-server mariadb-client 初始化Mariadb 设为开机自启 sudo systemctl enable mariadb 启动Mariadb sudo systemctl start mariadb 初始化Mariadb sudo mysql_secure_installa... 阅读详情

环境&版本
MairaDB 10.1.43
Ubuntu 20

更新仓库(非必要)

这一步其实不是必须的, 而是MariaDB推荐的. Ubuntu的Repository里的稳定版可能会比较老, 不是社区最新的稳定版. 因此MairaDB提供了更新仓库的脚步.
执行

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

这个脚本会设置3个不同的仓库到配置文件中, 包括:

MariaDB Repository
MariaDB MaxScale Repository
MariaDB Tools Repository
安装服务

sudo apt install mariadb-server

这里我曾经使用sudo apt install mariadb-server-10.4进行安装, 然而后续操作时出现了问题, 导致卸载重装了

启动服务

启动mariadb

sudo systemctl start mariadb

允许mariadb自启动

sudo systemctl enable mariadb

初始化配置

这一步很重要

$ 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): //因为之前没有设置密码,所以直接回车
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 authentication
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y //设置root密码
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] y //禁止远程登录root
 ... 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 //删除测试数据库
 - 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!

启动&重启关闭

查看状态

sudo systemctl status mysql

启动

sudo systemctl start mysql

重启

sudo systemctl restart mysql

关闭

sudo systemctl stop mysql

配置
登录
sudo mysql -u root -p #输入root 用户密码

创建远程登录用户 ,

格式:create user ‘用户名’@’%’ identified by ‘密码’;

> create user 'us'@'%' identified by '123';

授权(如果权限不足)

> GRANT ALL PRIVILEGES ON *.* TO 'us'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
> FLUSH PRIVILEGES;

不要开放root 远程登录权限

查看监听

netstat -an | grep 3306

tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN

如果显示 监听端口 是127.0.0.1:3306 那么其他计算机无法连接

修改配置

vi /etc/mysql/mariadb.conf.d/50-server.cnf#修改结束记得用重启指令重启mysql服务

Instead of skip-networking the default is now to listen only on
localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1 #注释掉这一行

重启后显示

tcp6 0 0 :::3306 ::? LISTEN

此时就可以远程访问mariadb了

远程访问
直接登录
mysql -h localhost -u us -p 123 #输入us 用户密码123
用客户端工具登录
sqlyog navicat hs
异常处理
Access denied for user ‘root’@‘localhost’

$ sudo systemctl stop mariadb # 停止服务
$ sudo mysqld_safe --skip-grant-tables & # 进入安全模式,并设置为后台进程
$ mysql -u root   # 登陆mysql

> select Host,User,plugin from mysql.user where User='root';  # 查询用户
> update mysql.user set plugin='mysql_native_password';  #重置加密模式
> update mysql.user set password=PASSWORD("newpassword") where User='root';  #重置密码
> flush privileges;  #刷新权限信息
> exit
$ sudo kill -9 $(pgrep mysql) # 杀掉进程
$ sudo service mariadb start # 重新启动服务
$ mysql -u root -p #登陆mysql, 安装unix_soket
$ install plugin unix_socket soname ‘auth_socket’;
Ubuntu下安装和配置MariaDB MariaDB 是一个流行的开源关系型数据库管理系统,是 MySQL 的一个分支,由 MySQL 的创始人开发和维护。MariaDB 完全兼容 MySQL,并且提供了许多增强功能和性能改进。MariaDB 以其稳定性和高性能受到广泛使用,适用于各种规模的应用。本文将详细介绍如何在 Ubuntu 系统上安装和配置 MariaDB,以确保其高效运行。 阅读详情

相关推荐

如何在 Ubuntu 24.04 上安装 MariaDB ?

MariaDB 是一个流行的开源关系数据库管理系统,它是 MySQL 的一个分支,它被广泛用于存储和管理数据。本指南将引导您完成在 Ubuntu 24.04 上安装 MariaDB 的步骤。

xiaochong0302的博客 2314

Ubuntu 离线安装mariadb 10.4及mysql初始化

下载安装包,首先清空/var/cache/apt/archives目录,这里选择备份,防止文件丢失。2.2 安装指定版本数据库,mariadb10.4版本,所以要修改源。在sources.list第一行添加如下内容,注意保留其他在线链接。编辑sources.list,在里面添加。安装mariadb-server。如有中文乱码问题可用如下命令查看。2.1 安装基础组件。2.4 离线装包打包。my.cnf参考文档。

2427

在Ubuntu上安装MariaDB以及初步设置

在Ubuntu上安装MariaDB以及初步设置

码农哈里 3313

mariadbubuntu离线安装包:轻松安装 Mariadb,网络限制不再是问题

mariadbubuntu离线安装包:轻松安装 Mariadb,网络限制不再是问题 【下载地址】mariadbubuntu离线安装包 该开源项目提供了一个专为Ubuntu系统设计的Mariadb离线安装包,特别适用于无网络连接或网络受限的环境。通过这个安装包,用户可以快速、便捷地部署Mariadb数据库,无需依赖在线资源...

gitblog_06718的博客 422

Ubuntu二进制tar包离线安装部署MariaDB数据库部署文件

Ubuntu二进制tar包离线安装部署MariaDB数据库部署文件 我的Ubuntu版本是16.04,mariadb版本是11.0.2,10版本我试了几个都不行,都需要依赖,所以就选择了比较新的11版本,可以去我的主页看一下怎么部署的,里面也有详细的部署说明

mariadb 10.3.22 linux arm64完整离线安装包

mariadb包含依赖包的完整离线安装,适用arm64架构的系统如UOS,deepin,ubuntu

ubuntu安装mariadb

ubuntu安装mariadb安装创建用户授权 安装 进入mariadb官方下载页面 点击repository configuration tool 按照自己的系统版本与处理器选择合适的mariadb版本与镜像 按照提示输入命令,等待安装就ok了 安装后在系统命令行输入 sudo mysql_secure_installation 配置安全设置,会有以下提示: Enter current pa...

Sirok_e的博客 796

基于51单片机的简易计算器设计(原理图+仿真+源代码+参考论文)

本设计以51单片机为核心,矩阵键盘输入数字,通过1602显示屏显示计算结果,能够实现整数的加、减、乘、除四则运算,具备清除功能。

u012759563的博客 7690

如何在Ubuntu上安装MariaDB

We can install MariaDB on Ubuntu from the Ubuntu repositories or the official MariaDB repositories. In this tutorial, we’ll go over both the methods in detail. 我们可以从Ubuntu存储库或官方MariaDB存储库在Ubuntu上安装Mar...

从零开始的教程世界 3448

从IPv6到Tomcat:彻底解决127.0.0.1拒绝连接的完整指南

本文提供了从IPv6到Tomcat的全面指南,帮助开发者彻底解决127.0.0.1拒绝连接的问题。涵盖网络协议栈、服务配置、端口管理等多个层面的排查方法,特别针对Tomcat服务提供了专项解决方案,确保开发者能够快速定位并修复连接问题。

weixin_29207439的博客 471

Ubuntu安装MariaDB教程

一、环境 服务器:Ubuntu 16.04.1 LTS(GUN/Linux 4.4.0-91-generic x86_64) 数据库版本:MariaDB 10.3 二、安装流程 2.1 进入MariaDB 网站 在https://downloads.mariadb.org/mariadb/repositories/#mirror=neusoft该地址中,可以查找对应系统的安装命令配置...

dlfryby306482969的博客 2172

集成calibre到cadence virtuoso环境中 load: can‘t access file - “/opt/eda/Mentor/lib/calibre.skl“

项目场景: 设想是将Calibre集成到cadence virtuoso中,但网上的解决办法尝试过在本机上实验都有点问题,因此想记录下来我的解决办法仅供参考。 问题描述: 安装好cadence, calibre之后打开virtuoso,CIW窗口显示 *Error* load: can't access file - "/opt/eda/Mentor/lib/calibre.skl" 问题是出在calibre.skl的加载路径出错,尝试网上的在工程目录下修改.cdsinit文件,添加calibre安装

weixin_52714276的博客 1万+

Ubuntu安装MariaDB

默认上MariaDB的包并没有在Ubuntu仓库中。要安装MariaDB,我们首先要设置MariaDB仓库。 设置 MariaDB 仓库 $ sudo apt-get install software-properties-common $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:8...

408

RFSOC实战解析:MTS多片同步的时序校准与相位相干实现

本文深入解析了在RFSOC平台上实现MTS多片同步的关键技术与实战流程。文章从相位相干的重要性出发,详细阐述了SYSREF与SYNC信号的协同工作机制,并提供了从硬件时钟配置到软件API调用的完整MTS实现步骤。重点探讨了时序校准的核心方法,旨在帮助工程师解决多通道系统相位不一致的难题,确保ADC与DAC达到精确的相位相干,从而构建高性能的MIMO和相控阵系统。

weixin_29206669的博客 192

【100%通过率】华为od机试C卷【出差 / 员工派遣】Java&Go 实现

某公司部门需要派遣员工去国外做项目。现在,代号为 x 的国家和代号为 y 的国家分别需要 cntx 名和 cnty 名员工部门每个员工有一个员工号 (1,2,3,......),工号连续,从 1开始。部长派遣员工的规则:

MISAYAONE的博客 2635

如何在Ubuntu 20.04上安装MariaDB

介绍 (Introduction) MariaDB is an open-source relational database management system, commonly used as an alternative for MySQL as the database portion of the popular LAMP (Linux, Apache, MySQL, PHP/Pyt...

1056

基于STM32L4XX的环境光传感器(AS7343-DLGMN)应用程序设计

define AS7343_STATUS_SPECTRAL_INT (1 << 3) /* 光谱数据就绪 */#define AS7343_SYS_CFG_SPECTRAL_EN (1 << 1) /* 光谱测量使能 */#define AS7343_SYS_CFG_ALS_EN (1 << 0) /* ALS使能 */#define AS7343_SYS_CFG_INT_EN (1 << 4) /* 中断使能 *//* 切换通道组 (0=组1 F1-F6, 1=组2 F7-F12) */

myron6688的博客 257

mariadb ubuntu离线安装包

mariadb ubuntu离线安装包 【下载地址】mariadbubuntu离线安装包 该开源项目提供了一个专为Ubuntu系统设计的Mariadb离线安装包,特别适用于无网络连接或网络受限的环境。通过这个安装包,用户可以快速、便捷地部署Mariadb数据库,无需依赖在线资源。安装包内包含Mariadb及其所有必要依赖...

gitblog_06748的博客 405

DCMM评估报告模板样例

这篇DCMM评估报告对某数据管理公司2020年的数据管理能力进行了全面分析。报告显示,该公司在数据战略方面取得初步进展,但在数据治理和数据架构方面仍存在明显不足,包括缺乏有效治理流程、数据质量监控不足,以及数据标准化和转换灵活性不足等问题。评估报告提出了针对性改进建议,包括完善数据战略、建立治理流程、加强质量监控和提升数据转换灵活性等,为提升数据管理成熟度提供了重要指导。

cdfunlove的博客 166

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

如何在 Ubuntu 20.04 上安装 MariaDB

本文最先发布在:https://www.itcoder.tech/posts/how-to-install-mariadb-on-ubuntu-20-04/ MariaDB 是一个开源的关系型数据库管理系统,向后兼容,可替代 MySQL。 MariaDB是由 MySQL 的一些原开发者和很多社区成员共同开发的。 这篇指南将会讲解如何在 Ubuntu 20.04 上安装和保护 MariaDB。 一、前提条件 我们假设你拥有 Ubuntu 服务器的管理权限,或者以 root 身份 或者以拥有 su..

雪梦科技 9302

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

如何在Ubuntu 18.04上安装MariaDB

介绍 (Introduction) MariaDB is an open-source database management system, commonly used as an alternative for the MySQL portion of the popular LAMP (Linux, Apache, MySQL, PHP/Python/Perl) stack. It is ...

581

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

上一篇: Ubuntu下安装、使用Redis
下一篇: Ubuntu下解决root账户登录mysql只能sudo登录的问题
那记忆微凉
博客等级 码龄9年 412粉丝 387原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值