centos7.6使用yum安装mariadb

1 安装

 yum install mariadb-server mariadb 

2 启动

mariadb数据库的相关命令是:

systemctl start mariadb  #启动MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重启MariaDB

systemctl enable mariadb  #设置开机启动

3 登录修改密码-第一次是无密码登录

set password for 'root'@'localhost' =password('password');

4 修改编码格式

vi /etc/my.cnf

在[mysqld]字段里加入

character-set-server=utf8

重启数据库
看编码格式

show variables like 'char%%';

改之前
centos7.6使用yum安装mariadb_第1张图片
改之后
centos7.6使用yum安装mariadb_第2张图片

开启远程连接

grant all privileges on *.* to root@'%'identified by 'password';

最后连接测试,不行就是防火墙问题了

你可能感兴趣的:(java)