Linux的mysql 数据库及开发包安装
创始人
2025-05-28 06:09:30
0

注意:以下操作都以 root 用户进行操作

直接按照下列步骤在命令行输入即可
下载
1:

sudo yum install -y mariadb

2:

sudo yum install -y mariadb-server

3:

sudo yum install -y mariadb-devel

接下来配置文件:在相应的配置文件中添加对应命令
4:

sudo vim /etc/my.cnf.d/client.cnf


# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#
[client]
# 新增下边一行配置,设置客户端默认字符集为utf8
default-character-set = utf8
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

5:

sudo vim /etc/my.cnf.d/mysql-clients.cnf

# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
# 新增配置
default-character-set = utf8
[mysql_upgrade]
[mysqladmin]
[mysqlbinlog]
[mysqlcheck]
[mysqldump]
[mysqlimport]
[mysqlshow]
[mysqlslap]

6:

sudo vim /etc/my.cnf.d/server.cnf

# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
# 新增以下四行配置
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
sql-mode = TRADITIONAL
# this is only for embedded server
[embedded]
# This group is only read by MariaDB-5.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mysqld-5.5]
# These two groups are only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
[mariadb-5.5]

⭐️
启动:

启动服务:

sudo systemctl start mariadb

设置服务开启自启动:

systemctl enable mariadb

查看服务状态:

systemctl status mariadb

测试连接

mysql -uroot
结果:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 190
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (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)]>

相关内容

热门资讯

Linux:使用libeven... 代码: #include #include #include #include ...
html入门学习 HTML 指的是超文本标记语言 (Hyper Text Markup Language)HTML 不...
安全知识小结 1.cookic和session你第一次注册网站时,网站会将你的用户名、加密后的密码、...
ssh介紹以及 linux 下... ssh介紹以及 linux 下ssh的安裝使用SSH协议简介SSH 的工作过程linux(ubunt...
Sentinel:流量控制规则... 一、概述 FlowSlot 会根据预设的规则,结合前面 NodeSelectorSlo...
学习笔记七:docker容器互... docker容器互联容器的网络基础docker0:安装网桥管理工具:do...
面试阿里测开岗失败后,被面试官... 前一阵子有个徒弟向我诉苦,说自己在参加某大厂测试面试的时候被面试官怼得哑口无言...
CCNP300-410学习笔记... 151、 Refer to the exhibits An engineer filtered m...
kubernetes核心组件原... 文章目录核心组件原理1、RC[控制器]2、RS[控制器]3、Deployment4、HPA5、Sta...
华为OD机试 - 数组组成的最... 最近更新的博客 华为od 2023 | 什么是华为od,od 薪资待遇,od机试题清单华为OD机试真...
java.sql.Time 字... 项目场景: 情况:最近有一个很奇怪的事情,项目已经上线了一...
一文读懂!跨境支付业务详解 随着全球电子商务的增长,面向进出口贸易的跨境支付应运而生。据华创微课统计,...
MySQL的隐式类型转换 引入 在项目中调用别的部门的模糊查询接口,发现还根据模糊字段搜索主键,还...
redis教程3 (特性以及五... redis 特性以及五种数据类型的编码特点适用场景redis特性优势(快)...
理解 zk-SNARKs 和 ... SNARK 和 STARK 是零知识证明技术,允许一方在不透露任何进一步信息的情况下向...
【JavaSE】继承的详解 前言 大家好,我是那个不会打拳的程序猿。今天我给大家带来的是面向对象之封装继承多态中...
Delta并联机械臂实现电磁铁... 1. 功能说明 本文示例将利用Delta并联机械臂实现不同点定点搬运磁铁物料的效果。  2. 结构...
高标准农田信息化监测系统解决方... 一、方案背景 《中共中央国务院关于做好2023年全面推进乡村振兴重点工作的意见》指出,...
从0开始实现java Stre... java8 stream介绍 java8新增了stream流的特性,能够让用户以函数式...
Windows_安装整合Pro... 安装包下载 prometheus windows_exporter pushgateway graf...