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

二进制安装指定版本的MariaDBv10.11.6

一、官网下载mariadb安装包

Download MariaDB Server - MariaDB.org

找到对应的版本

下载安装包后上传到服务器这里不再赘述。

二、安装二进制包

1、解压安装包

2、查看安装包内的安装提示文档根据提示文档进行安装

# 解压安装包
tar xf mariadb-10.11.6-linux-systemd-x86_64
# 进入安装包
d Testing."
mariadb-10.11.6-linux-systemd-x86_64]# ls
bin      CREDITS  include         lib  mysql-test  README-wsrep  share      support-files
COPYING  docs     INSTALL-BINARY  man  README.md   scripts       sql-bench  THIRDPARTY
mariadb-10.11.6-linux-systemd-x86_64]# head -n 10 INSTALL-BINARY 
MariaDB and MySQL have identical install methods. In this document we
describe how to install MariaDB.

The full documentation for installing MariaDB can be found at
https://mariadb.com/kb/en/library/binary-packages/
However most documentation at www.mysql.com also applies.

2.2. Installing MariaDB from Generic Binaries on Unix/Linux

   This section covers the installation of MariaDB binary distributions

3、复制目录到/usr/local下

4、创建MySQL用户,给目录授权MySQL权限

# 把安装目录复制到/usr/local下 这里可以任意目录
cp -r mariadb-10.11.6-linux-systemd-x86_64 /usr/local/mysql
# 创建MySQL用户 授予MySQL权限
useradd mysql
chown -R mysql:mysql /usr/local/mysql/

# 创建日志目录
mkdir -p /var/log/mariadb
cd /var/log/
chown mysql:mysql mariadb

5、初始化数据库

 mysql]# cd /usr/local/mysql/
 mysql]# scripts/mysql_install_db --user=mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
OK

To start mariadbd at boot time you have to copy
support-files/mariadb.service to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at https://mariadb.com/kb

You can start the MariaDB daemon with:
cd '.' ; ./bin/mariadb-safe --datadir='/var/lib/mysql'

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

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

The latest information about MariaDB is available at https://mariadb.org/.

Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

6、配置系统服务

# 启动数据库
bin/mysqld_safe --user=mysql &

# 把启动服务加到服务里
cd /usr/local/mysql/support-files
sudo cp mysql.server /etc/init.d/mariadb
sudo chmod +x /etc/init.d/mariadb
sudo systemctl enable mariadb
sudo systemctl start mariadb  # 这里启动会一直卡着直接ctrl退出就好了

致此安装完成

三、验证服务

配置账号密码及权限

bin]# cd /usr/local/mysql/bin
bin]# ./mariadb -uroot -p --socket=/var/lib/mysql/mysql.sock
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.11.6-MariaDB MariaDB Server

Copyright (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)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123qweASD';
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

用另外一台mysql登录验证账号密码及权限

# 输入正确的密码
mysql]# mysql -uroot -p -h 10.50.11.120 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 10.11.6-MariaDB MariaDB Server

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

# 输入错误的密码
mysql]# mysql -uroot -p -h 10.50.11.120 
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'10.50.78.121' (using password: YES)

相关文章:

  • 珠算之珠心算观想算盘
  • 基于Python+Vue开发的鲜花商城管理系统源码+运行步骤
  • 深度学习基础:线性代数本质4——矩阵乘法
  • 机器学习之超参数优化(Hyperparameter Optimization)
  • 【leetcode hot 100 23】合并K个有序链表
  • 图像识别技术与应用-YOLO
  • AI日报 - 2025年3月13日
  • Spring Boot 整合 Druid 并开启监控
  • 软件版本号设计
  • IEC61850标准下MMS 缓存报告控制块 ResvTms详细解析
  • 十种处理权重矩阵的方法及数学公式
  • python-leetcode 49.二叉树中的最大路径和
  • 【ES6】ES6中的类
  • 侯捷C++课程学习笔记:构造函数那些事儿(四)
  • 微信h5环境使用开放标签(wx-open-launch-weapp)打开三方小程序
  • 【商城实战(25)】解锁UniApp移动端适配秘籍,打造完美商城体验
  • 第一章:Tailwind CSS基础与项目设置 - 第一节:Tailwind CSS入门 - 核心理念与工作流
  • BGP 规划问题、路由黑洞与环路
  • 面试之《前端常见的设计模式》
  • Quantum Computing:量子计算如何改变世界
  • 专利申请全球领先!去年我国卫星导航与位置服务产值超5700亿元
  • 一条铺过11年时光的科学红毯,丈量上海科创的“长宽高”
  • 新修订的《餐饮业促进和经营管理办法》公布,商务部解读
  • 跨越三十年友情,61岁余隆和60岁齐默尔曼在上海再度合作
  • 北方产粮大省遭遇气象干旱,夏粮用水如何解决?
  • 向猫学习禅修之后,你会发现将生活降格为劳作是多么愚蠢