当前位置: 首页 > news >正文

Linux的mysql 数据库及开发包安装

注意:以下操作都以 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)]>
http://www.lryc.cn/news/39848.html

相关文章:

  • π-Day快乐:Python可视化π
  • 【论文速递】ACM MM 2022 - 基于统一对比学习框架的新闻多媒体事件抽取
  • 数据库分库分表
  • 【C缺陷与陷阱】----语义“陷阱”
  • JavaWeb--VUE
  • 2分钟彻底搞懂“高内聚,低耦合”
  • 网络编程UDP TCP
  • 【2023-Pytorch-检测教程】手把手教你使用YOLOV5做电线绝缘子缺陷检测
  • 交叉编译(NDK)
  • 【数据库】MySQL 解读事务的意义及原则
  • 【Linux】冯诺依曼体系结构
  • 【小白】git是什么?gitee和git和github的关系?
  • UDS 14229 -1 刷写34,36,37服务,标准加Trace讲解,没理由搞不明白
  • 【Android -- 软技能】聊聊程序员的软技能
  • 【Java学习笔记】27.Java 抽象类
  • Vite4 + Vue3 + vue-router4 动态路由
  • MS(mbed l432KC)-->速通9个lab详细解析[5]
  • XXE漏洞复现
  • 初识C++需要了解的一些东西(2)
  • 全国程序员薪酬大曝光!看完我酸了····
  • 改进YOLO系列 | CVPR2023最新Backbone | FasterNet 远超 ShuffleNet、MobileNet、MobileViT 等模型
  • Nginx常见用法
  • MySQL存储引擎和日志管理
  • Arduino 驱动DS1307时钟模块使用介绍
  • 为什么 Python 没有 main 函数?
  • 【无标题】使用Bibtex4word 整理毕业论文参考文献
  • 19--网络API(java版)
  • ElasticSearch - 分片内部原理之动态更新索引、近实时搜索、持久化变更、段合并
  • 模拟数据采集卡之ADCTDC 模拟时间/数字转换器组合应用选型指南
  • R语言编程基础