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)]>

相关内容

热门资讯

ip是安卓系统吗,通过IP地址... 你有没有想过,那个陪伴你每天刷剧、玩游戏、办公的IP,它是不是安卓系统呢?别急,今天就来揭开这个谜底...
安卓系统谁负责升级,揭秘幕后负... 你有没有想过,你的安卓手机为什么有时候会突然收到系统更新的通知呢?是不是好奇,是谁在背后默默地为你的...
安卓系统需要降级吗,安卓系统升... 你有没有发现,你的安卓手机最近有点儿“老态龙钟”了呢?运行速度慢吞吞的,有时候还卡个不停。这时候,你...
性价比手机安卓系统,盘点安卓系... 你有没有想过,在这个手机更新换代如此迅速的时代,如何用最少的钱,买到最满意的手机呢?没错,我要说的是...
虚拟大师安卓2.0系统,安卓新... 你有没有听说最近虚拟大师安卓2.0系统火得一塌糊涂?这可不是空穴来风,而是真的让不少手机用户都跃跃欲...
谷歌同步安卓10系统,智能体验... 你知道吗?最近谷歌又放大招了,安卓10系统正式上线啦!这可是个大新闻,咱们得好好聊聊。想象你的手机瞬...
米9安卓系统最高,小米9安卓系... 你有没有发现,最近你的手机是不是有点儿不给力了?别急,别急,让我来给你揭秘为什么你的小米9安卓系统最...
五菱安卓系统下载,开启智能出行... 你有没有听说最近五菱汽车也要玩儿高科技了?没错,就是那个我们平时在路上随处可见的“神车”——五菱宏光...
华为安卓6.0系统特点,创新与... 你知道吗?华为的安卓6.0系统最近可是火得一塌糊涂呢!作为一个紧跟科技潮流的数码达人,我必须得给你好...
安卓系统指令怎么用,或者根据标... 你有没有想过,你的安卓手机里那些神秘的系统指令其实就像是一把神奇的钥匙,能帮你解锁手机的各种隐藏功能...
最好用安卓系统排行,2023年... 你有没有想过,为什么安卓系统这么受欢迎呢?没错,就是那个几乎无处不在的操作系统。今天,就让我带你一起...
红辣椒刷安卓系统,深度解析与全... 你有没有想过,你的安卓手机里竟然也能装上红辣椒的系统?没错,就是那个让无数游戏玩家热血沸腾的红辣椒!...
surface 3跑安卓系统,... 你有没有想过,如果你的Surface 3也能跑安卓系统,那会是怎样的场景呢?想象你手中的平板瞬间变成...
安卓系统自带手机壁纸,探索安卓... 亲爱的手机控们,你是否曾好奇过,为什么你的安卓手机里会有那些精美的壁纸?今天,就让我带你一探究竟,揭...
安卓屏幕装鸿蒙系统,跨平台新体... 你知道吗?最近在手机圈子里,有个话题可是火得一塌糊涂,那就是——安卓屏幕装鸿蒙系统。是不是听起来有点...
安卓电视改造系统教程,轻松打造... 亲爱的电视迷们,你是否厌倦了安卓电视那千篇一律的系统界面?想要给它来个焕然一新的改造?别急,今天我就...
优品才子安卓系统,引领智能生活... 你知道吗?在手机操作系统界,最近可是掀起了一股“优品才子”安卓系统的热潮呢!这款系统不仅功能强大,而...
小米电视安装安卓系统,打造智能... 亲爱的读者们,你是否也像我一样,对小米电视的强大性能和智能体验情有独钟?但你是否知道,小米电视其实可...
安卓系统路由表,揭秘网络数据传... 你有没有想过,你的安卓手机里那些看似复杂的设置,其实背后隐藏着不少小秘密呢?比如,今天咱们就要来聊聊...
安卓系统的广告拦截,守护您的手... 你有没有发现,手机里的安卓系统越来越智能了,但随之而来的广告也越来越多,简直让人头疼不已。今天,就让...