yum install mysql mysql-server mysql-devel -y # 启动服务 yum install -y mariadb-server systemctl start mariadb.service # 开放3306端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload firewall-cmd --zone=public --list-ports # 或关闭防火墙 systemctl stop firewalld.service systemctl disable firewalld.service # 启动mysql客户端 mysql -u root -p # 默认没有密码 回车即可 use mysql; update user set password=password('root') where user='root' and host='localhost'; flush privileges; # 授权远程访问 grant all privileges on *.* to 'root' @'%' identified by 'root'; flush privileges; # 设置开机启动 systemctl enable mariadb.service # 修改字符编码 cd /usr/share/mysql cp my-small.cnf /etc/my.cnf vi /etc/my.cnf # 修改内容 character_set_server=utf8 # 重启mysql服务 systemctl restart mariadb.service
3. 安装Tomcat
1 2 3 4 5 6 7 8
tar -zxvf apache-tomcat-9.0.34.tar.gz cd apache-tomcat-9.0.34/ cd bin # 启动tomcat ./startup.sh # 开放8080端口 防火墙关闭则不用 firewall-cmd --zone=public --add-port=8080/tcp --permanent systemctl restart firewalld.service