欢迎投稿

今日深度:

CentOS7安装MariaDB步骤,centos7mariadb步骤

CentOS7安装MariaDB步骤,centos7mariadb步骤


1. 通过yum安装

# 先更新一下
yum upgrade
# 安装
yum -y install mariadb mariadb-server
# 启动服务
systemctl start mariadb

2. 进行基本选项配置

mysql_secure_installation

3. 编码配置(重点)

# 编辑/etc/my.cnf
vim /etc/my.cnf

# 在[mysqld]标签下添加下面内容
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

# 编辑/etc/my.cnf.d/client.cnf
vim /etc/my.cnf.d/client.cnf

# 在[client]标签下添加下面内容
default-character-set=utf8

# 编辑/etc/my.cnf.d/mysql-clients.cnf
vim /etc/my.cnf.d/mysql-clients.cnf

# 在[mysql]标签下添加下面内容
default-character-set=utf8

4. 重启服务

systemctl restart mariadb
# 设置开机自启动
systemctl enable mariadb

5. 创建用户和表的过程

创建前要先登录root

mysql -uroot -ppassword;

5.1 创建数据库

create database databasename;

5.2 为数据库创建用户

-- 本地访问
create user 'username'@'localhost' identified by 'password';
-- 远程访问
create user 'username'@'%' identified by 'password';
-- 授权
grant all privileges on databasename.* to username@'%';
grant all privileges on databasename.* to username@'localhost';
flush privileges;

www.htsjk.Com true http://www.htsjk.com/mariadb/36182.html NewsArticle CentOS7安装MariaDB步骤,centos7mariadb步骤 1. 通过yum安装 # 先更新一下 yum upgrade # 安装 yum -y install mariadb mariadb-server # 启动服务 systemctl start mariadb 2. 进行基本选项配置 mysql_secure_installation 3...
相关文章
    暂无相关文章
评论暂时关闭