从最新版本centos7开始,默认的是 Mariadb而不是mysql!
使用系统自带的repos安装很简单:
yum install mariadb mariadb-server
systemctl start mariadb ==> 启动mariadb
systemctl enable mariadb ==> 开机自启动
firewall-cmd --permanent --add-port=3306/tcp ==> 开放端口,允许远程访问
systemctl restart firewalld==> 重启防火墙
mysql_secure_installation ==> 设置 root密码等相关
mysql -uroot -p密码 ==> 测试登录!
授权root远程任何机器都能登陆
use mysql;
update mysql set host=‘%‘ where user=‘root‘ and host=‘localhost‘;
flush privileges;
或
grant all privileges on *.* to ‘[email protected]%‘ identified by ‘密码‘ with grant option;
flush privileges;
时间: 2024-10-16 06:14:04