mariadb5.5.56在centos7.6环境安装

news2025/6/9 10:31:43

mariadb5.5.56在centos7.6环境安装

1 下载安装包

https://mariadb.org/mariadb/all-releases/#5-5

2 上传安装包的服务器

mariadb-5.5.56-linux-systemd-x86_64.tar.gz

3 解压安装包

tar -zxvf mariadb-5.5.56-linux-systemd-x86_64.tar.gz
mv mariadb-5.5.56-linux-systemd-x86_64 /mariadb

4 创建data目录

mkdir -p /data/mariadb_5_5_56

5 修改my.cnf

cp /mariadb/support_files/my-small.cnf /etc/my.cnf

# cat /etc/my.cnf|grep -Ev "^$|^#"
[client]
port            = 3306
socket          = /tmp/mysql.sock
[mysqld]
basedir         = /mariadb
datadir         = /data/mariadb_5_5_56
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 240K
server-id       = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout

6 初始化数据库

# ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb_5_5_56
Installing MariaDB/MySQL system tables in '/data/mariadb_5_5_56' ...
250607 10:46:22 [Note] /mariadb/bin/mysqld (mysqld 5.5.56-MariaDB) starting as process 16500 ...
OK
Filling help tables...
250607 10:46:23 [Note] /mariadb/bin/mysqld (mysqld 5.5.56-MariaDB) starting as process 16509 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/mariadb/bin/mysqladmin' -u root password 'new-password'
'/mariadb/bin/mysqladmin' -u root -h exam01 password 'new-password'

Alternatively you can run:
'/mariadb/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/mariadb' ; /mariadb/bin/mysqld_safe --datadir='/data/mariadb_5_5_56'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/mariadb/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

---------------------------------------------------------------
[root@exam01 soft]# cd /data/mariadb_5_5_56/
[root@exam01 mariadb_5_5_56]# ll
total 28
-rw-rw---- 1 mysql mysql 16384 Jun  7 10:46 aria_log.00000001
-rw-rw---- 1 mysql mysql    52 Jun  7 10:46 aria_log_control
drwx------ 2 mysql root   4096 Jun  7 10:46 mysql
drwx------ 2 mysql mysql  4096 Jun  7 10:46 performance_schema
drwx------ 2 mysql root      6 Jun  7 10:46 test

7 配置启动服务

cd support_files
cp mysql.server /etc/init.d/mariadb
vi /etc/init.d/mariadb
修改basedir ,datadir路径

8 加载并启动服务

[root@exam01 support-files]# systemctl  daemon-reload
[root@exam01 mariadb]# systemctl start mariadb
[root@exam01 mariadb]# systemctl status mariadb
● mariadb.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mariadb; bad; vendor preset: disabled)
   Active: active (running) since Sat 2025-06-07 11:02:35 CST; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 17652 ExecStart=/etc/rc.d/init.d/mariadb start (code=exited, status=0/SUCCESS)
    Tasks: 20
   Memory: 79.3M
   CGroup: /system.slice/mariadb.service
           ├─17666 /bin/sh /mariadb/bin/mysqld_safe --datadir=/data/mariadb_5_5_56 --pid-file=/data/mariadb_5_5_56/exam01.pid
           └─17936 /mariadb/bin/mysqld --basedir=/mariadb --datadir=/data/mariadb_5_5_56 --plugin-dir=/mariadb/lib/plugin --user=mysql --log...

Jun 07 11:02:32 exam01 systemd[1]: Starting LSB: start and stop MySQL...
Jun 07 11:02:33 exam01 mariadb[17652]: Starting MySQL.250607 11:02:33 mysqld_safe Logging to '/data/mariadb_5_5_56/exam01.err'.
Jun 07 11:02:33 exam01 mariadb[17652]: 250607 11:02:33 mysqld_safe Starting mysqld daemon with databases from /data/mariadb_5_5_56
Jun 07 11:02:35 exam01 mariadb[17652]: . SUCCESS!
Jun 07 11:02:35 exam01 systemd[1]: Started LSB: start and stop MySQL.
[root@exam01 mariadb]# ps -ef |grep mariadb
root     17666     1  0 11:02 ?        00:00:00 /bin/sh /mariadb/bin/mysqld_safe --datadir=/data/mariadb_5_5_56 --pid-file=/data/mariadb_5_5_56/exam01.pid
mysql    17936 17666  0 11:02 ?        00:00:00 /mariadb/bin/mysqld --basedir=/mariadb --datadir=/data/mariadb_5_5_56 --plugin-dir=/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb_5_5_56/exam01.err --pid-file=/data/mariadb_5_5_56/exam01.pid --socket=/tmp/mysql.sock --port=3306

9 修改root密码

[root@exam01 mariadb]# '/mariadb/bin/mysqladmin' -u root -h exam01 password 'root'

10 验证登录失败

修改完密码之后测试登录失败,不知道问题在哪

[root@exam01 mariadb]# mysql -uroot -hlocalhost -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@exam01 mariadb]# 
[root@exam01 mariadb]# mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@exam01 mariadb]# 
[root@exam01 mariadb]# mysql -uroot -p -h127.0.0.1
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

11 修改密码

窗口1
[root@exam01 ~]# cd /mariadb/bin/
[root@exam01 bin]# ./mysqld_safe --skip-grant-tables &
[1] 19686
[root@exam01 bin]# 250607 11:23:50 mysqld_safe Logging to '/data/mariadb_5_5_56/exam01.err'.
250607 11:23:50 mysqld_safe Starting mysqld daemon with databases from /data/mariadb_5_5_56


窗口2
[root@exam01 ~]# mysql -uroot -p
Enter password:      <<<<<<<<<<<<<  直接回车
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2021, 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> use mysql;
Database changed
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> update mysql.user set password=password('root') where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

12 再次登录正常

[root@exam01 bin]# ps -ef |grep mysql
root     19686 19158  0 11:23 pts/0    00:00:00 /bin/sh ./mysqld_safe --skip-grant-tables
mysql    19944 19686  0 11:23 pts/0    00:00:00 /mariadb/bin/mysqld --basedir=/mariadb --datadir=/data/mariadb_5_5_56 --plugin-dir=/mariadb/lib/plugin --user=mysql --skip-grant-tables --log-error=/data/mariadb_5_5_56/exam01.err --pid-file=exam01.pid --socket=/tmp/mysql.sock --port=3306
root     20256 19158  0 11:28 pts/0    00:00:00 grep --color=auto mysql
[root@exam01 bin]# 
[root@exam01 bin]# 
[root@exam01 bin]# kill -9 19686 19944
[1]+  Killed                  ./mysqld_safe --skip-grant-tables
[root@exam01 bin]# 
[root@exam01 bin]# systemctl start mariadb
[root@exam01 bin]# systemctl status mariadb
● mariadb.service - LSB: start and stop MySQL
   Loaded: loaded (/etc/rc.d/init.d/mariadb; bad; vendor preset: disabled)
   Active: active (running) since Sat 2025-06-07 11:28:25 CST; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 20281 ExecStart=/etc/rc.d/init.d/mariadb start (code=exited, status=0/SUCCESS)
    Tasks: 20
   Memory: 49.3M
   CGroup: /system.slice/mariadb.service
           ├─20295 /bin/sh /mariadb/bin/mysqld_safe --datadir=/data/mariadb_5_5_56 --pid-file=/data/mariadb_5_5_56/exam01.pid
           └─20567 /mariadb/bin/mysqld --basedir=/mariadb --datadir=/data/mariadb_5_5_56 --plugin-dir=/mariadb/lib/plugin --user=mysql --log...

Jun 07 11:28:23 exam01 systemd[1]: Starting LSB: start and stop MySQL...
Jun 07 11:28:24 exam01 mariadb[20281]: Starting MySQL.250607 11:28:24 mysqld_safe Logging to '/data/mariadb_5_5_56/exam01.err'.
Jun 07 11:28:24 exam01 mariadb[20281]: 250607 11:28:24 mysqld_safe Starting mysqld daemon with databases from /data/mariadb_5_5_56
Jun 07 11:28:25 exam01 mariadb[20281]: . SUCCESS!
Jun 07 11:28:25 exam01 systemd[1]: Started LSB: start and stop MySQL.
[root@exam01 bin]# pwd
/mariadb/bin
[root@exam01 bin]# ./mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

在这里插入图片描述
附:
第10步骤 登录失败的原因已经找到,由于第9步修改密码的时候指定了host的主机名。在mysql.user表记录的是root ,exam01

MariaDB [(none)]> use mysql;
Database changed
MariaDB [mysql]> 
MariaDB [mysql]> select user,host from user;
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
|      | exam01    |
| root | exam01    |   <<<<<<<<<<<<<<<<<<
|      | localhost |
| root | localhost |
+------+-----------+
6 rows in set (0.00 sec)

尝试指定host主机名是可以正常登录的。

[root@exam01 bin]# mysql -uroot -hexam01 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2021, 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> 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2405246.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

打造你的 Android 图像编辑器:深入解析 PhotoEditor 开源库

&#x1f4f8; 什么是 PhotoEditor&#xff1f; PhotoEditor 是一个专为 Android 平台设计的开源图像编辑库&#xff0c;旨在为开发者提供简单易用的图像编辑功能。它支持绘图、添加文本、应用滤镜、插入表情符号和贴纸等功能&#xff0c;类似于 Instagram 的编辑体验。该库采…

Azure 虚拟机端口资源:专用 IP 和公共 IP Azure Machine Learning 计算实例BUG

## 报错无解 找不到Azure ML 计算实例关联的 NSG .env 文件和 ufw status&#xff1a; .env 文件中 EXPOSE_NGINX_PORT8080 是正确的&#xff0c;它告诉 docker-compose.yaml 将 Nginx 暴露在宿主机的 8080 端口。 sudo ufw status 显示 Status: inactive&#xff0c;意味着宿…

Java核心技术-卷I-读书笔记(第十二版)

第一章 Java程序设计概述 09年sun被oracle收购->11年java7&#xff08;简单改进&#xff09;->14年java8&#xff08;函数式编程&#xff09;->2017年java9->2018年java11->2021年java17 第二章 Java编程环境 Java9后新增JShell&#xff0c;提供类似脚本试执…

MATLAB遍历生成20到1000个节点的无线通信网络拓扑推理数据

功能&#xff1a; 遍历生成20到1000个节点的无线通信网络拓扑推理数据&#xff0c;包括网络拓扑和每个节点发射的电磁信号&#xff0c;采样率1MHz/3000&#xff0c;信号时长5.7s&#xff0c;单帧数据波形为实采 数据生成效果&#xff1a; 拓扑及空间位置&#xff1a; 节点电磁…

卫星接收天线G/T值怎么计算?附G/T计算excel表格链接

我们在进行无线通信链路设计时&#xff0c;都会涉及接收天线最重要的参数G/T。今天&#xff0c;咱们就来聊聊G/T值该怎么计算&#xff0c;计算过程中有哪些需要留意的地方&#xff0c;以及当你看到产品说明书中标注了G/T指标&#xff0c;还需要进一步了解哪些信息。 G/T的含义 …

基于dify的营养分析工作流:3分钟生成个人营养分析报告

你去医院做体检&#xff0c;需要多久拿到体检报告呢&#xff1f;医院会为每位病人做一份多维度的健康报告吗&#xff1f;"人工报告需1小时/份&#xff1f;数据误差率高达35%&#xff1f;传统工具无法个性化&#xff1f; Dify工作流AI模型的组合拳&#xff0c;正在重塑健康…

新成果:GaN基VCSEL动态物理模型开发

作为高速数据传输与光电信号处理的核心器件&#xff0c;垂直腔面发射激光器&#xff08;VCSEL&#xff09;在高速光通信、激光雷达等领域应用广泛&#xff0c;其动态特性直接关联器件调制速率及稳定性等关键参数。近期&#xff0c;天津赛米卡尔科技有限公司技术团队开发了GaN基…

Appium+python自动化(十一)- 元素定位- 下

1、 List定位 List顾名思义就是一个列表&#xff0c;在python里面也有list这一个说法&#xff0c;如果你不是很理解什么是list&#xff0c;这里暂且理解为一个数组或者说一个集合。首先一个list是一个集合&#xff0c;那么他的个数也就成了不确定性&#xff0c;所以这里需要用复…

免费批量PDF转Word工具

免费批量PDF转Word工具 工具简介 这是一款简单易用的批量PDF转Word工具&#xff0c;支持&#xff1a; 批量转换多个PDF文件保留原始格式和布局快速高效的转换速度完全免费使用 工具地址 下载链接 网盘下载地址&#xff1a;点击下载 提取码&#xff1a;8888 功能特点 ✅…

Mac/iOS 如何解压 RAR 格式压缩包:常用工具与详细操作步骤

一、Mac 系统解压 RAR 文件之法 Mac 系统上解压 RAR 文件有多种方法&#xff0c;除了系统自带的一些简单功能外&#xff0c;还可以借助特定的软件来实现高效解压。以下将介绍几款常用工具的解压操作。 &#xff08;一&#xff09;解压专家解压步骤 解压专家 是一款在 Mac 和 …

机器学习监督学习实战四:九种回归算法对波士顿房价数据进行回归预测和评估方法可视化

本项目代码在个人github链接&#xff1a;https://github.com/KLWU07/Machine-learning-Project-practice/tree/main 处理流程 1.导入波士顿房价数据集并进行预处理。2.使用 GradientBoostingRegressor 模型进行回归分析。3.通过交叉验证评估模型的性能&#xff0c;计算 MAE、…

微软重磅发布Magentic UI,交互式AI Agent助手实测!

微软重磅发布Magentic UI,交互式AI Agent助手实测! 何为Magentic UI? Magentic UI 是微软于5.19重磅发布的开源Agent助手,并于24日刚更新了第二个版本0.04版 从官方的介绍来看,目标是打造一款 以人为中心 的智能助手,其底层由多个不同的智能体系统驱动,能够实现网页浏览…

老年生活照护实训室建设规划:照护质量评估与持续改进实训体系

随着人口老龄化程度的不断加深&#xff0c;老年生活照护需求日益增长&#xff0c;对专业照护人才的培养提出了更高要求。老年生活照护实训室建设方案作为培养高素质照护人才的重要载体&#xff0c;其核心在于构建科学完善的照护质量评估与持续改进实训体系。通过该体系的建设&a…

【python深度学习】Day 48 PyTorch基本数据类型与操作

知识点&#xff1a; 随机张量的生成&#xff1a;torch.randn函数卷积和池化的计算公式&#xff08;可以不掌握&#xff0c;模型会自动计算的&#xff09;pytorch的广播机制&#xff1a;加法和乘法的广播机制 ps&#xff1a;numpy运算也有类似的广播机制&#xff0c;基本一致 作…

【大模型】【推荐系统】LLM在推荐系统中的应用价值

文章目录 A 论文出处B 背景B.1 背景介绍B.2 问题提出B.3 创新点B.4 两大推荐方法 C 模型结构C.1 知识蒸馏&#xff08;训练过程&#xff09;C.2 轻量推理&#xff08;部署过程&#xff09; D 实验设计E 个人总结 A 论文出处 论文题目&#xff1a;SLMRec&#xff1a;Distilling…

uni-app学习笔记二十九--数据缓存

uni.setStorageSync(KEY,DATA) 将 data 存储在本地缓存中指定的 key 中&#xff0c;如果有多个key相同&#xff0c;下面的会覆盖掉原上面的该 key 对应的内容&#xff0c;这是一个同步接口。数据可以是字符串&#xff0c;可以是数组。 <script setup>uni.setStorageSyn…

工作邮箱收到钓鱼邮件,点了链接进去无法访问,会有什么问题吗?

没事的&#xff0c;很可能是被安全网关拦截了。最近做勒索实验&#xff0c;有感而发&#xff0c;不要乱点击邮箱中的附件。 最初我们采用钓鱼邮件投递恶意载荷&#xff0c;发现邮件网关把我们的 exe/bat 程序直接拦截了&#xff0c;换成压缩包也一样拦截了&#xff0c;载荷始终…

基于安卓的线上考试APP源码数据库文档

摘 要 21世纪的今天&#xff0c;随着社会的不断发展与进步&#xff0c;人们对于信息科学化的认识&#xff0c;已由低层次向高层次发展&#xff0c;由原来的感性认识向理性认识提高&#xff0c;管理工作的重要性已逐渐被人们所认识&#xff0c;科学化的管理&#xff0c;使信息存…

【数据结构】顺序表和链表详解(下)

前言&#xff1a;上期我们从顺序表开始讲到了单链表的概念&#xff0c;分类&#xff0c;和实现&#xff0c;而这期我们来将相较于单链表没那么常用的双向链表。 文章目录 一、双向链表二&#xff0c;双向链表的实现一&#xff0c;增1&#xff0c;头插2&#xff0c;尾插3&#x…

【系统架构设计师】绪论-系统架构概述

目录 绪论 系统架构概述 单选题 绪论 系统架构概述 单选题 1、软件方法学是以软件开发方法为研究对象的学科。其中&#xff0c;&#xff08;&#xff09;是先对最高居次中的问题进行定义、设计、编程和测试&#xff0c;而将其中未解决的问题作为一个子任务放到下一层次中去…