Mysql8安装

本文最后更新于:2022年5月2日 凌晨

Windows下安装Mysql8

提前准备

参考:

28天PHP零基础入门到精通教程(P1基础6天)
https://www.bilibili.com/video/BV18x411H7qD

Mysql 8安装教程
https://blog.csdn.net/qq_33236248/article/details/80046448

PHP7加载MySQL
https://blog.csdn.net/u010536669/article/details/105073587/

php 7.4连接MySQL
https://blog.csdn.net/username666/article/details/105122763/

过程

  1. 官网下载安装包

    进入下载页面点最底下的 MySQL Community (GPL) Downloads »,之后进入MySQL Installer for Windows之后选择第二个大的安装包下载。

  2. 安装各种环境……

    被这玩意卡了好久,推荐去百度下载一套VS运行库……然后安装好这些,在安装mysql的时候还是提示VS运行库有问题,搞了半天也不行,最后硬着头皮点下一步了,最后依然安装成功了~~~~~~~~

  3. 打开刚下好的Mysql安装包,看着按钮点就行,我是选择 Developer Default (默认安装),要记住自己设置的用户名和密码(我的都是root)。

  4. 添加环境变量

    C:\Program Files\MySQL\MySQL Server 8.0\bin
  5. 测试Mysql是否安装成功

    (用 Mysqll 命令行客户端或 Mysql 的 workbench 可视化工具都行,这里是 CMD 的)

    打开CMD,root处换成你的用户名

    mysql -u root -p

    然后第二行输入你的密码,之后会显示:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 8
    Server version: 8.0.22 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, 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.
    

    之后输入

    show databases;

    显示

    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | sakila             |
    | sys                |
    | world              |
    +--------------------+
    6 rows in set (0.15 sec)

    退出的话输入 \qexit 都行

  6. Php连接Mysql

    修改php.ini文件

    如果这里没修改的

    extension_dir = “ext”

    将地址填完整(前面 ; 不要)

    extension_dir = "D:\Apache\Php7\ext"

    去掉下面两句前面的 ;

    ;extension=mysqli
    ;extension=pdo_mysql

完成后重启Apche ! ! !


Mysql8安装
https://blog.ksfu.top/posts/afa1/
作者
康师傅
发布于
2020年12月5日
许可协议