首页 > 数据库 >快速部署MySQL数据库

快速部署MySQL数据库

时间:2024-09-25 18:54:33浏览次数:3  
标签:5.6 部署 数据库 MySQL 36 mysql root localhost

一.下载对应的软件版本

下载地址:http://mirrors.sohu.com/mysql/MySQL-5.6/

备用地址:http://ftp.ntu.edu.tw/pub/MySQL/Downloads/

[root@localhost ~]# wget -q http://mirrors.sohu.com/mysql/MySQL-5.6/sql-5.6.36-linux-glibc2.5-x86_64.tar.gz

二、解压、配置用户和权限

[root@localhost ~]# mkdir -pv  /Data/apps
[root@localhost ~]# tar xf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz -C /Data/apps/
[root@localhost ~]# cd /Data/apps/
[root@localhost apps]# mv mysql-5.6.36-linux-glibc2.5-x86_64/ mysql-5.6.36
[root@localhost ~]# useradd -s /sbin/nologin -M mysql
[root@localhost ~]# chown -R mysql.mysql  /Data/apps/mysql-5.6.36
[root@localhost ~]# cd /Data/apps/mysql-5.6.36

三、初始化数据库

[root@localhost mysql-5.6.36]#  cp support-files/my-default.cnf /etc/my.cnf 
[root@localhost mysql-5.6.36]# ./scripts/mysql_install_db --basedir=/Data/apps/mysql-5.6.36/ --datadir=/Data/apps/mysql-5.6.36/data/ --user=mysql
[root@localhost mysql-5.6.36]# cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.6.36]# chmod +x /etc/init.d/mysqld
[root@localhost mysql-5.6.36]# sed -i 's#/usr/local/mysql#/Data/apps/mysql-5.6.36#g' /etc/init.d/mysqld #主要最后都没有'/'
[root@localhost mysql-5.6.36]# service mysqld start
Starting MySQL.Logging to '/Data/apps/mysql-5.6.36/data/localhost.localdomain.err'.
..                                                         [确定]
[root@localhost mysql-5.6.36]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      947/sshd            
tcp        0      0 :::22                       :::*                        LISTEN      947/sshd            
tcp        0      0 :::3306

四、配置MySQL环境变量

[root@localhost mysql-5.6.36]# echo "export PATH=/Data/apps/mysql-5.6.36/bin:$PATH" > /etc/profile.d/mysql.sh
[root@localhost mysql-5.6.36]# . /etc/profile.d/mysql.sh

五、测试登录

root@localhost mysql-5.6.36]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.36    |
+-----------+
1 row in set (0.05 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.15 sec)

六、配置安全策略(建议)

[root@localhost mysql-5.6.36]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
.................................
..............................略

 

"一劳永逸" 的话,有是有的,而 "一劳永逸" 的事却极少



标签:5.6,部署,数据库,MySQL,36,mysql,root,localhost
From: https://blog.51cto.com/u_8901540/12111444

相关文章

  • mysql优化之sql语句优化、以及mysql一些高频面试题
    文章目录一、索引1、什么是索引2、添加索引的原则3、索引的优缺点4、索引分类5、mysql存储过程(方法)二、MySQL的逻辑架构1、逻辑架构2、MyISAM和InnoDB的区别三、mysql的索引数据结构1、BTree2、B+Tree四、缓冲池BufferPool1、预读机制2、预读失效3、淘汰策略五......
  • jenkins 搭建 uniapp h5部署服务
    项目中需要适用jenkins搭建uniapph5部署服务,初次接触,踩了很多坑,记录下主要分为两步骤:1.创建uniapp打包环境由于创建打包环境的步骤有手动确定项目,所以不能通过jenkins自动创建,需要先到目录中手动配置环境2.搭建jenkins自动化部署步骤任务把jenkins工作目录配置为刚才的环......
  • 架构师日记-从数据库发展历程到数据结构设计探析
    一数据库发展史起初,数据的管理方式是文件系统,数据存储在文件中,数据管理和维护都由程序员完成。后来发展出树形结构和网状结构的数据库,但都存在着难以扩展和维护的问题。直到七十年代,关系数据库理论的提出,以表格形式组织数据,数据之间存在关联关系,具有了良好的结构化和规范化特......
  • Reis数据库及key的操作命令汇总
    管理命令命令含义BGREWRITEAOF异步执行一个AOF(AppendOnlyFile)文件重写操作BGSAVE在后台异步保存当前数据库的数据到磁盘CLIENT关闭客户端连接CLIENTLIST获取连接到服务器的客户端连接列表CLIENTGETNAME获取连接的名称CLIENTPAUSE在指定时间内终止运行来自客户端的命......
  • QT5程序部署提示缺少Qt5系统库问题的解决方法 symbol lookup error /libQt5XcbQpa.so.
    https://blog.csdn.net/qq_29852231/article/details/128853681 QT5程序部署提示缺少Qt5系统库问题的解决方法问题:在用QT5.12开发程序后,部署至现场(Ubuntu18/20)发现提示缺少QT5的平台库(platform)或者系统提供的QT5平台库无法正常支撑程序运行解析:经过研究发现,即时将Platform文件......
  • mysql数据库 - anolisos安装
    文章目录一、anolisos系统介绍1.1、anolisos系统的起源1.2、anolisos系统的版本支持1.3、anolisos系统的特点1.4、anolisos系统的适用场景二、环境部署2.1、修改主机名2.2、修改静态ip地址2.3、关闭selinux2.4、关闭或放通防火墙端口三、安装mysql数据库3.1、更新yum源......
  • 如何部署北斗定位应用,基于国产自主架构LS2K1000LA-i处理器平台
    北斗卫星导航系统(以下简称北斗系统)是着眼于国内经济社会发展需要,自主建设、独立运行的卫星导航系统。经过多年发展,北斗系统已成为面向全球用户提供全天候、全天时、高精度定位、导航与授时服务的重要新型基础设施。图1北斗定位系统的应用优势强可控:北斗系统是国内自主研发的......
  • 大模型项目部署时Gradio Web页面打不开或者打开用不了及pydantic.errors.PydanticSche
    问题描述 在复现大模型demo时连接器和模型加载都没问题,但是gradio界面打不开或者打开后用不了原因分析:感觉应该是gradio的版本问题导致该文件缺少相关文件解决方案:可以首先按照上面要求下载文件https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_a......
  • Linux常用命令(Mysql)
    --删除表内数据(Mysql)usedc;#切换到待删除表所在的数据库truncatetable[表名]#删除表--数据库导入SQL文件数据(Mysql)sourcea.sql;--SQL增删改查insertintostudent(id,name,sex,birth)values('01','赵雷','男','1990');deletefromstudentwhereid=......
  • Windows Server 安装MySQL教程(图文)
    本篇教程,在服务器WindowsServer2016(中文版)上安装MySQL8.0,并记录详细的安装步骤。1、下载安装包在mysql官网上下载安装包下载地址:https://dev.mysql.com/downloads/installer/2、安装步骤下载之后,双击运行mysql-installer-community-8.0.39.0.msi如果双击无反应,那么需要安装一......