linux 下安装mysql
一,安装 yum -y install mariadb mariadb-serve
二, 开启服务systemctl start mariadb
--- 可能报错unit not found
解决办法 现此问题是由于安装mariadb数据库时未安装mariadb-server服务器,执行命令
1:yum install mariadb-server
2:yum -y install mariadb-server mariadb mariadb-client mariadb-devel
systemctl list-unit-files --type=service
查看所有服务
1,2 执行一个就行 这块我也不到为啥
三 服务启动
systemctl start mariadb
#启动服务
systemctl enable mariadb
#设置开机启动
systemctl restart mariadb
#重新启动
systemctl stop mariadb.service
#停止MariaDB
四 端口
firewall-cmd --query-port=3306/tcp
# 查看3306端口是否开启
firewall-cmd --zone=public --add-port=3306/tcp --permanent
# 开启3306端口
firewall-cmd --reload
# 重启防火墙
五 远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
指定ip
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
#执行这个生效