1、下载MariaDB数据库测试:当前虚拟机是否能正确连接外网。命令:[root@localhostsrc]#yuminstallmariadb-server安装mariadb数据库[root@localhostsrc]#yumcleanall下载失败后执行,清除已安装的文件。2.确认下载3.安装完成时提示4.数据库启动命令:1.启动命令[root@localhostsrc]#systemctlstartmariadb2.重启命令[root@localhostsrc]#systemctlrestartmariadb3.关机命令[root@localhostsrc]#systemctlstopmariadb4.开机自启动[root@localhostsrc]#systemctlenablemariadb5.关闭自启动[root@localhostsrc]#systemctldisablemariadb5.数据库初始化操作命令:`mysql_secure_installation'6.测试数据库用户名和密码是否有效7.导入数据表注意:如果mysql数据库需要导入数据表,命令如下:命令:source/xxx/xxxx/xxxx/jtdb.sql;8.Mysql数据库远程访问配置8.1连接数据库说明:如果需要远程连接数据库,必须通过防火墙。如果需要远程连接数据库,必须在数据库中开启远程访问权限,否则连接被拒绝。8.2配置数据库权限配置说明8.3配置Linux数据库权限8.3.1切换数据库mysql切换Mysql数据库8.3.2修改数据库表1).查数据表2)。查询用户表中的host/root/password3).将host="localhost"更改为"%"4)。刷新数据库权限9.配置Linux防火墙策略9.1查看防火墙状态命令:firewall-cmd--state9.2防火墙配置说明:防火墙中有一个配置文件,意思是Linux系统启动时防火墙应该怎么用!!!需求:告诉linux系统以后不需要启动防火墙。命令:systemctldisablefirewalld.servicesystemctlenablefirewalld.service9.3手动关闭防火墙说明:通过命令手动关闭防火墙命令:systemctlstopfirewalld.servicesystemctlstartfirewalld.service9.4手动开启防火墙端口1)。检查防火墙打开的端口firewall-cmd--list-ports`2).检查端口是否开放firewall-cmd--query-port80/tcp3)。打开防火墙firewall-cmd--zone=public--add-port=80/tcp--permanent4)。删除端口firewall-cmd--zone=public--remove-port=9090/tcp--permanent5)。防火墙操作说明–zone#Scope–add-port=80/tcp#添加端口,格式为:端口/通信协议–remove-port=80/tcp#删除端口,格式为:端口/通信协议–permanent#永久生效,没有这个参数,重启后会失效6).重启防火墙firewall-cmd--reload9.5databaseremotetest9.6importjtdb.sql
