温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何二进制安装mariadb数据库10.5.3版本

发布时间:2021-11-16 11:36:44 来源:亿速云 阅读:230 作者:小新 栏目:云计算

小编给大家分享一下如何二进制安装mariadb数据库10.5.3版本,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

二进制安装mariadb数据库10.5.3版本

由于mariadb10.5.3版本是2020年5月12日发布所以为了尝鲜,今天特地二进制编译了一下 #进入到/usr/local/src目录下,然后通过在清华源上下载10.5.3版本的mariadb数据库

[22:29:34 root@a7 ~]#wget https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.5.3/bintar-linux-systemd-x86_64/mariadb-10.5.3-linux-systemd-x86_64.tar.gz

#创建mysql用户

[22:32:59 root@a7 ~]#useradd mysql -s /sbin/nologin -M

#创建自定义数据库目录

[22:33:15 root@a7 ~]#mkdir /data/mysql/mysql3306/{data,binlog,logs,tmp} -p

#对mysql3306这个目录进行授权,授权给mysql用户

[22:49:32 root@a7 ~]#cd /data/mysql/;chown -R mysql.mysql  mysql3306

#安装相关依赖包

22:49:33 root@a7 mysql]#yum install libaio.x86_64 libaio-devel.x86_64 novacom-server.x86_64 libedit -y

#回到root目录,解压安装包、指定解压到/usr/local

[22:50:11 root@a7 mysql]#cd
[18:04:45 root@a7 ~]#tar xf mariadb-10.5.3-linux-systemd-x86_64.tar.gz -C /usr/local/

#进入到/usr/local/src目录下添加一个mysql的软连接

[17:13:49 root@a7 ~]#cd /usr/local/
[17:21:14 root@a7 local]#ln -s mariadb-10.5.3-linux-systemd-x86_64 mysql

#提示:初始化时要在/usr/local/mysql/ 目录下创建一个空的影藏文件.my.cnf文件,否则会提示文件不存在,导致初始化失败。

[17:21:14 root@a7 local]#cd /usr/local/mysql/;touch .my.cnf

#初始化命令

[17:25:50 root@a7 mysql]#./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/mysql3306/data  --defaults-file=./.my.cnf

#修改/etc/my.cnf配置文件、指定数据库存放目录。

[22:36:11 root@a7 mysql]#vim /etc/my.cnf

[mysqld]

datadir=/data/mysql/mysql3306/data #指定数据库存放目录 socket=/tmp/mysql.sock #指定启动的sock文件

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

#初始化好了就配置mariadb启动方式

[22:23:08 root@a7 mysql]#cp support-files/systemd/mariadb.service /usr/lib/systemd/system/mariadb.service

#启动mariadb服务

[22:59:25 root@a7 mysql]#systemctl start mariadb

#然后在查看端口、3306已经起来

[22:59:28 root@a7 mysql]#ss -ntl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128            *:111                        *:*                  
LISTEN     0      5      192.168.122.1:53                         *:*                  
LISTEN     0      128            *:22                         *:*                  
LISTEN     0      128    127.0.0.1:631                        *:*                  
LISTEN     0      100    127.0.0.1:25                         *:*                  
LISTEN     0      128    127.0.0.1:6010                       *:*                  
LISTEN     0      128    127.0.0.1:6011                       *:*                  
LISTEN     0      80            :::3306                      :::*

#做软连接,通过mysql命令来进入交互模式

[23:15:57 root@a7 mysql]#ln -s /usr/local/mysql/bin/mysql /usr/bin/
[23:16:07 root@a7 mysql]#mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.5.3-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)]>

以上是“如何二进制安装mariadb数据库10.5.3版本”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI