Linux下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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章