码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • mysql 5.7版本的 安装流程 和 官方文档说明


    文章目录

    • mysql install
      • ref
      • 官方资料
      • 安装
      • 一些问题

    mysql install

    ref

    官方文档:

    mysql_doc

    zip安装方式

    Installing and Upgrading MySQL

    网页右上角可以选择mysql版本

    官方资料

    总体步骤:

    1. Extract the main archive to the desired install directory

      Optional: also extract the debug-test archive if you plan to execute the MySQL benchmark and test suite

    2. Create an option file

    3. Choose a MySQL server type

    4. Initialize MySQL

    5. Start the MySQL server

    6. Secure the default user accounts

    具体步骤:

    1. Extract the main archive to the desired install directory

     Traditionally, the MySQL server is installed in C:\mysql. If you do not install MySQL at C:\mysql, you must specify the path to the install directory during startup or in an option file
    

    解压到安装目录,如果不是C:\mysql,就需要在开始的时候或者在配置文件(option file)中指定安装路径。

    2. Create an option file

    If you need to specify startup options when you run the server, you can indicate them on the command line or place them in an option file.
    

    用于在运行服务器时设置启动参数

    关于option file的具体使用: Section 4.2.2.2, “Using Option Files”

    会在哪里找这个配置文件呢?

    it looks for option files in several locations, such as the Windows directory, C:\, and the MySQL installation directory (for the full list of locations, Section 4.2.2.2, “Using Option Files”)
    
    • Windows directory

      • C:\> echo %WINDIR%
        
      • 一般是C:\WINDOWS

    • MySQL installation directory

    MySQL looks for options in each location first in the my.ini file, and then in the my.cnf file.
    
    • 先找my.ini文件,再找my.cnf文件
    • 避免混淆,就用my.ini就行

    option file常用配置

    [mysqld]
    # 设置安装路径
    basedir=E:/mysql
    # 设置数据目录
    datadir=E:/mydata/data
    

    As of MySQL 5.7.6, the ZIP archive no longer includes a data directory. To initialize a MySQL installation by creating the data directory and populating the tables in the mysql system database, initialize MySQL using either --initialize or --initialize-insecure. For additional information, see Section 2.10.1, “Initializing the Data Directory”.

    创建data目录

    3. Choose a MySQL server type

    BinaryDescription
    mysqldOptimized binary with named-pipe support
    mysqld-debugLike mysqld, but compiled with full debugging and automatic memory allocation checking

    使用mysqld就行

    4. Initialize MySQL

    To initialize the data directory, use the instructions at Section 2.10.1, “Initializing the Data Directory”.

    进入到安装目录的bin目录:

    mysqld --initialize --console
    

    会在最后一行输出密码:

    2022-09-29T15:35:34.834474Z 1 [Note] A temporary password is generated for root@localhost: ?eL1Uss,:bNI
    

    5. Start the MySQL server

    6. Secure the default user accounts

    安装

    设置环境变量,第一次安装时没有进入到mysql安装目录的bin目录,安装没成功;

    修改密码:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';
    

    主体步骤:

    解压文件

    设置my.ini文件

    设置系统变量

    # 安装mysql服务
    mysqld install
    # 出错了就用 remove 卸载
    mysqld remove
    
    # 初始化mysql
    # 会输出到控制台,最后一行有默认密码
    mysqld --initialize --console 
    
    # 开启mysql服务
    # 注意,第一次启动时,应该进入到bin目录,否则可能会报:
    # 			发生系统错误 2 系统找不到指定的文件
    # 后面再次启动时,就只要在以管理员运行cmd的终端就行
    net start mysql
    
    # 登录
    mysql -u root -p
    
    # 修改密码
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password'
    
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysqlpbc'
    

    其他命令:

    # 关闭服务
    mysqladmin -u root -p shutdown
    

    一些问题

    MySQL 服务正在启动 .MySQL 服务无法启动。

  • 相关阅读:
    MTK system_server 卡死导致手机重启案例分析
    React props属性使用及子传父组件使用
    [LeetCode/力扣][Java] 0315. 计算右侧小于当前元素的个数(Count of Smaller Numbers After Self)
    Linux的基本使用和Web程序部署(JavaEE初阶系列18)
    Golang实现Redis分布式锁(Lua脚本+可重入+自动续期)
    PHP 获取类对象的信息
    GitHub的原理及应用详解(一)
    通信中间件 Fast DDS 基础概念简述与通信示例
    Gromacs分析处理-模拟前后蛋白结构差异对比图的制作
    HTML学生个人网站作业设计成品 HTML+CSS肖战明星人物介绍网页 web结课作业的源码
  • 原文地址:https://blog.csdn.net/qq_37774098/article/details/127116120
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号