MariaDB部署「建议收藏」

MariaDB部署「建议收藏」环境 系统:CentOS Linux release 7.8.2003 (Core) 内核:3.10.0-693.el7.x86_64 1.安装启动MariaDB 安装mariadb 和 maria…

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

代码100分

配置开机自启动并启动服务

代码100分 systemctl enable --now mariadb

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}

修改配置文件

代码100分  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

MariaDB部署「建议收藏」

3.设置密码

 mysql_secure_installation

MariaDB部署「建议收藏」

MariaDB部署「建议收藏」

MariaDB部署「建议收藏」

重启mariadb服务

 systemctl restart mariadb.service

4.验证部署结果

  mysql -u root -p

Enter password:

MariaDB部署「建议收藏」

MariaDB [(none)]> show variables like "%character%";

MariaDB部署「建议收藏」

MariaDB [(none)]> show variables like "%collation%";

MariaDB部署「建议收藏」

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部署完毕。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/7608.html

(0)
上一篇 2023-03-17
下一篇 2023-03-17

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注