首页 > 其他分享 >二进制安装mariadb-10.6.11

二进制安装mariadb-10.6.11

时间:2022-12-02 13:22:05浏览次数:64  
标签:11 systemd MariaDB 10.6 root usr mysql mariadb local

二进制安装MariaBD

1.源下载

# 官方源下载不方便这里使用清华源
wget https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.6.11/bintar-linux-systemd-x86_64/mariadb-10.6.11-linux-systemd-x86_64.tar.gz

2.解压创建软连接

# 解压安装包
tar -xvf mariadb-10.6.11-linux-systemd-x86_64.tar.gz -C /usr/local/
ln -vs /usr/local/mariadb-10.6.11-linux-systemd-x86_64/ /usr/local/mysql

3.创建用户 创建文件夹

# 创建组及用户
groupadd -g 1002 mysql
useradd -s /sbin/nologin -g mysql -u 1002 -M mysql

# 创建文件夹
mkdir -p /usr/local/mysql/{data,logs,tmp}
chown -R mysql.mysql /usr/local/mysql/

4.创建环境变量

# 设置环境变量
echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
. /etc/profile.d/mysql.sh

# 加入systemd管理
cp /usr/local/mysql/support-files/systemd/mysqld.service /usr/lib/systemd/system/

5.创建配置文件

[root@node2 ~]# vim /etc/my.cnf
[client]
port = 3306
default-character-set = utf8mb4

[mysqld]
basedir = /usr/local/mysql
datadir=/usr/local/mysql/data/
innodb_buffer_pool_size=128M
port=3306
symbolic-links=0

[mysqld_safe]
log-bin = mysql-bin
log-error=/usr/local/mysql/logs/mysql.log

6.初始化,安全初始化数据库

# 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql

# 安全初始化
mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
# 输入root密码开始初始化默认没密码 直接回车就行
Enter current password for root (enter for none): 

# 输入y开始初始化
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y

# 输入y开始修改root密码
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y

# 输入y删除匿名用户
Remove anonymous users? [Y/n] y
 ... Success!

# 输入y禁止root远程登录
Disallow root login remotely? [Y/n] y
 ... Success!

# 输入y删除测试数据库
Remove test database and access to it? [Y/n] y
 - Dropping test database...

# 输入y刷新数据库
Reload privilege tables now? [Y/n] y
 ... Success!

7.登录测试

[root@node2 ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.6.11-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)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.001 sec)

参考链接

https://blog.csdn.net/cnskylee/article/details/124174078

标签:11,systemd,MariaDB,10.6,root,usr,mysql,mariadb,local
From: https://www.cnblogs.com/feifa/p/16944167.html

相关文章

  • 11Linux网络配置
    网络配置Linux网络配置原理图指定固定IPubuntu:(26条消息)Ubuntu网络配置文件_ayang1986的博客-CSDN博客_ubuntu网络配置文件......
  • 使用.NET7和C#11打造最快的序列化程序-以MemoryPack为例
    译者注本文是一篇不可多得的好文,MemoryPack的作者neuecc大佬通过本文解释了他是如何将序列化程序性能提升到极致的;其中从很多方面(可变长度、字符串、集合等)解释了一......
  • 11月业务安全月报
    11月业务安全月报|台湾2300万人信息泄露;黑客两分钟即可破解安卓锁屏;乌克兰”IT军团“入侵俄罗斯中央银行导语:随着数字化的深入普及,业务愈加开放互联。企业的关键数据、......
  • Win10升Win11后出现的文件系统错误-1073740771的几种可能解决办法
    可能性1有服务没能启动键盘按“WIN+R”打开“运行”对话框在对话框输入“services.msc”点击“确定”按钮。会出现如下界面。下拉至Windows部分,找到“WindowsLicens......
  • Debian11 安装
    1.开启虚拟机2.断开网络连接【断网安装】断网安装的原因:Debian的服务器在国外,联网安装系统会从官网库中下载某些包,会导致拖慢安装进度,断网安装不会影响使用。【点击......
  • 云锵投资 2022 年 11 月简报
    2022年11月云锵投资团队月报:摘要本月量化基金策略业绩:良;本月量化股票策略业绩:优;(优良中差,表明全国排名四位分)本月,沪深300-7.78%。本月开始回暖,市场形成比较明显......
  • 5118的伪原创代码提取内容方法并附带火车头插件写法
    今天应一个朋友请求,要求写个5118的伪原创插件,他的接口输出的默认是json形式输出,很不方便,要提取里面伪原创的结果,并附上代码。<?php$host="http://apis.5118.com";......
  • 2022.11.29 vjudge构造、思路题
    WeightingaTree构造切入点:调整总结:图上的题,可以先考虑树上的做法。(尤其是构造题)首先我们要知道这种“点与跟他连着的所有边的关系”什么的题的套路就是找生成树。-......
  • 升级到win11 22h2的体验
    win1122h2更稳定了在win1122h2发布后没多久,我就升级到了这个版本,截止目前已经使用半个月了,谈谈我的使用感受。总体要比之前的版本更稳定,表现为笔记本风扇不会突然响,突......
  • p1102 A-B数对
    A-B数对题目背景出题是一件痛苦的事情!相同的题目看多了也会有审美疲劳,于是我舍弃了大家所熟悉的A+BProblem,改用A-B了哈哈!题目描述给出一串正整数数列以及一个正......