MariaDB部署
短信预约 信息系统项目管理师 报名、考试、查分时间动态提醒
系统:CentOS Linux release 7.8.2003 (Core)
内核:3.10.0-693.el7.x86_64
1.安装启动MariaDB
安装mariadb 和 mariadb-server
yum install -y mariadb mariadb-server
配置开机自启动并启动服务
systemctl enable --now mariadb
2.配置MariaDB
备份原有配置文件
cp /etc/my.cnf{,.bak}
cp /etc/my.cnf.d/client.cnf{,.bak}
cp /etc/my.cnf.d/mysql-clients.cnf{,.bak}
修改配置文件
cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.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
init_connect="SET collation_connection = utf8_unicode_ci"
init_connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
transaction-isolation=READ-COMMITTED
[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
cat /etc/my.cnf.d/mysql-clients.cnf
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
default-character-set=utf8
[mysql_upgrade]
[mysqladmin]
[mysqlbinlog]
[mysqlcheck]
[mysqldump]
[mysqlimport]
[mysqlshow]
[mysqlslap]
cat /etc/my.cnf.d/client.cnf
#
# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#
[client]
default-character-set=utf8
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
重启mariadb服务
systemctl restart mariadb.service
systemctl status mariadb.service
3.设置密码
mysql_secure_installation
重启mariadb服务
systemctl restart mariadb.service
4.验证部署结果
mysql -u root -p
Enter password:
MariaDB [(none)]> show variables like "%character%";
MariaDB [(none)]> show variables like "%collation%";
5.常用SQL--创建数据库并授权远程访问
MariaDB [(none)]> create database confluence default character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all on confluence.* to "admin"@"%" identified by "admin";
MariaDB[(none)]> grant all on confluence.* to "admin"@"localhost" identified by"admin";
MariaDB [(none)]> flush privileges;
至此,MariaDB部署完毕。
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341