企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。 ## MariaDB服务 查询MariaDB ``` yum info mariadb yum info mariadb-server ``` 安装和配置MariaDB服务 ``` yum install mariadb-server -y systemctl start mariadb systemctl enable mariadb systemctl status mariadb mysql_secure_installation # Follow the instruction ... ... ``` 查询socket statistics状态(TCP 3306) ``` ss -antp | grep mysqld ``` 配置防火墙例外 ``` firewall-cmd --permanent --add-service=mysql firewall-cmd --reload firewall-cmd --list-services ``` ## 数据库维护 基本操作 ``` mysql -u root -p create database myDB; show databases; grant all privileges on myDB.* to myDBowener@'%' identified by '123.com'; grant select on myDB.* to myDBread@'%' identified by '123.com'; flush privileges; show grants for myDBread; ``` 备份数据库 ``` mkdir /backup mysqldump -uroot -p123.com myDB | gzip > /backup/myDB.sql.gz ls /backup ``` 恢复数据库 ``` cd /backup gunzip myDB.sql.gz ls cat myDB.sql | mysql -uroot -p123.com myDB ``` 备份数据库脚本 ``` #/bin/bash sub_folder=$(date +%Y%m%d) cd /backup mkdir $sub_folder backup_file=/backup/$sub_folder/myDB.sql.gz mysqldump -uroot -p123.com myDB | gzip > $backup_file ``` MariaDB 10.1数据库连结问题(高版本) Host is not allowed to connect to this MariaDB server ``` UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND host = 'localhost'; ```