Linux下yum安装mariadb

CentOS下MariaDB安装与配置
本文介绍在CentOS Linux 7.7系统上安装和配置MariaDB数据库的过程,包括防火墙设置、SELinux状态确认、通过YUM安装MariaDB,以及服务启动和安全初始化步骤。
//系统
# less /etc/redhat-release 
CentOS Linux release 7.7.1908 (AltArch)
# uname -r
4.19.84-v7l.1.el7
//firewall设置
# firewall-cmd --zone=public --permanent --add-service=mysql
# firewall-cmd --reload
# firewall-cmd --list-service	//可以看到MySQL已经打开
//SELinux设置
# getsebool 
getsebool:  SELinux is disabled
//mariadb版本
# mysql -V
mysql  Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (armv7l) using readline 5.1
//yum安装
# yum -y install mariadb mariadb-devel mariadb-server
//mariadb提供了一些my.cnf示例,在 /usr/share/mysql 路径中,可以阅读参考README.mysql-cnf
//后附一个自己用的示例
# systemctl start mariadb.service	//启动服务
# systemctl enable mariadb.service	//设置开机自启
//检查进程、端口
# lsof -i:3306
# ps aux|grep mysql
# /usr/bin/mysql_secure_installation	//进行安全设置(初始化)
===================分割线===================
Enter current password for root (enter for none):   #没密码直接回车
Set root password? [Y/n]: Y                         # 设置密码
New password: your-MariaDB-root-password
Re-enter new password: your-MariaDB-root-password
Remove anonymous users? [Y/n]: Y                    # 删除匿名账户
Disallow root login remotely? [Y/n]: n              # 是否禁止管理员从远程登录
Remove test database and access to it? [Y/n]: Y     # 删除test数据库并取消访问
Reload privilege tables now? [Y/n]: Y               # 刷新授权表,让初始化后生效
===================分割线===================

##/etc/my.cnf示例
[client]
port        = 3306
socket      = /var/lib/mysql/mysql.sock


[mysqld]
port        = 3306
socket      = /var/lib/mysql/mysql.sock
datadir = /data/mysqlDB
bind-address = 0.0.0.0
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8

default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8


log-bin=mysql-bin

server-id   = 1



[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash


[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值