赞
踩
下述操作均在Centos与Oracle Linux 8-9中验证,其他linux系统仅供参考
安装完成后执行(安装过程略)
mariadb-secure-installation
设置MariaDB字符集. 需要设置4个文件my.cnf, client.cnf, mysql-clients.cnf, mariadb-server.cnf.cnf
- [client]
- default-character-set = utf8mb4
-
- [mysql]
- default-character-set = utf8mb4
-
- [mysqld]
- character-set-client-handshake = FALSE
- character-set-server = utf8mb4
- collation-server = utf8mb4_unicode_ci
- [client]
- default-character-set=utf8mb4
- [mysql]
- default-character-set=utf8mb4
- [server]
- character-set-server=utf8mb4
- systemctl restart mariadb
- systemctl status mariadb #检查运行状态
登陆数据库后执行
- mysql -uroot -p
- #输入密码后登陆数据库
-
- show variables like "%character%";
- show variables like "%collation%";
- create database 数据库名;
-
- create user '用户名'@'%' identified by '密码';
-
-
- grant all on 数据库名.* to '用户名'@'%'; #不限制ip地址登陆
- grant all on *.* to 'backup'@'%'; #备份用户
-
- flush privileges;
- quit
- firewall-cmd --zone=public --add-port=3306/tcp --permanent
- firewall-cmd --reload
- firewall-cmd --list-ports
- #!/bin/bash
- bakdir=~/
- d=$(date +%F)
- user=用户名
- passwd=密码
- host=数据库地址
-
- mariadb-dump -u$user -p$passwd -h $host --all-databases > $d
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。