mariadb的一些配置

1.修改初始密码

yum install -y mariadb mariadb-server;
systemctl start mariadb.service 
systemctl enable mariadb.service
mysqladmin -u root password '123456';

2.配置远程访问

GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";#授权远程连接
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO root@"localhost" IDENTIFIED BY "123456";#授权本地连接
flush privileges;

在这里插入图片描述

3.配置数据库字符集

show variables like '%char%';

在这里插入图片描述
修改配置文件

cat /etc/my.cnf
character-set-server = utf8

在这里插入图片描述

4修改数据库地址

1****************************************.一定要关闭selinux

[mysqld]
character-set-server = utf8
#datadir=/var/lib/mysql
datadir=/home/mysql
#socket=/var/lib/mysql/mysql.sock
socket=/home/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[client]
socket=/home/mysql/mysql.sock
# 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
[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

5修改数据库用户

use mysql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'sssssss';
FLUSH PRIVILEGES;

6 mariadb10.3.35

[client-server]
socket=/home/mysql/mysql.sock #修改的

[mysqld]
character-set-server = utf8
datadir=/home/mysql           #修改的
symbolic-links=0


[client]
default-character-set=utf8

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#!includedir /etc/my.cnf.d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值