当前位置: 首页 > Linux

Linux安装MariaDB数据库

时间:2023-04-06 06:24:19 Linux

下载MariaDB数据库测试:当前虚拟机是否可以正确连接外网。命令:[root@localhostsrc]#yuminstallmariadb-server安装mariadb数据库[root@localhostsrc]#yumcleanall如果下载失败则清除已安装的文件之后执行。2.确认下载3.提示4.数据库启动命令:1.启动命令[root@localhostsrc]#systemctlstartmariadb2。重启命令[root@localhostsrc]#systemctlrestartmariadb3。关闭命令[root@localhostsrc]#systemctlstopmariadb数据库初始化操作命令:mysql_secure_installation测试数据库用户名和密码是否有效7.导入数据表说明:如果mysql数据库需要导入数据表,命令如下如下:命令:source/xxx/xxxx/xxxx/jtdb.sql;8.Mysql数据库远程访问配置8.1连接数据库说明:如果需要远程连接数据库,必须通过防火墙。如果需要远程链接数据库,必须在数据库中开启远程访问权限,否则链接会被拒绝。8.2配置数据库权限配置说明8.3配置Linux数据库权限8.3.1切换数据库mysql8.3.2切换Mysql数据库8.3.3修改数据库表1).检查数据表2)。在用户表3)中查询主机/root/密码。将host="localhost"改为"%”4).刷新数据库权限,配置Linux防火墙策略9.1查看防火墙状态命令:firewall-cmd--state9.2防火墙配置说明:防火墙中有一个配置文件,表示linux系统启动时防火墙应该怎么操作!!!要求:告诉linux系统开机后不需要启动防火墙命令:systemctldisablefirewalld.servicesystemctlenablefirewalld.service9.3手动关闭防火墙说明:通过命令手动关闭防火墙Command:1.systemctl停止firewalld.service2。systemctlstartfirewalld.service9.4手动开启防火墙端口1).查看防火墙firewall-cmd--list-ports2)打开的端口。检查端口是否打开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#添加端口,格式为:port/communicationprotocol–remove-port=80/tcp#移除端口,格式为:port/communicationprotocol–permanent#永久有效,没有该参数,重启后失效5).重启防火墙firewall-cmd--reload9.4databaseremotetest9.5importjtdb.sql