1,安装mysql
1.1 下载mysql
https://dev.mysql.com/downloads/mysql/5.7.html#downloads,选择【Windows (x86, 32-bit), ZIP Archive】,然后点击【No thanks, just start my download.】
1.2 解压并存放于【C:\Software_App\mysql-5.7.29-win32】,查看是否存在data目录和ini配置文件。若无,则创建data目录。
1.3 新建【my.ini】配置文件,内容如下:
[mysqld]
port = 3306 # 端口
basedir=C:\Software_App\mysql-5.7.29-win32 # mysql目录
datadir=C:\Software_App\mysql-5.7.29-win32\data # mysql的data目录
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
default-character-set=utf8
1.4 系统环境变量
新建环境变量,MYSQL_HOME,值,C:\Software_App\mysql-5.7.29-win32
1.5 管理员运行cmd,进入目录【C:\Software_App\mysql-5.7.29-win32】
C:\WINDOWS\system32>cd c:\Software_App\mysql-5.7.29-win32\bin
c:\Software_App\mysql-5.7.29-win32\bin>mysqld --initialize # 初始化
c:\Software_App\mysql-5.7.29-win32\bin>mysqld -install # 安装
Service successfully installed.
c:\Software_App\mysql-5.7.29-win32\bin>net start mysql # 创建服务
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
c:\Software_App\mysql-5.7.29-win32\bin>
坑,如果运行命令提示:由于找不到MSVCR120.dll,无法继续执行代码.重新安装程序可能…
这种情况需要安装 vcredist
下载vcredist :https://www.microsoft.com/zh-CN/download/details.aspx?id=40784
下载后,直接安装。
1.6 重新启动mysql服务,设置账号和密码
(1),在my.ini配置文件中添加如下
[mysqld]
skip-grant-tables # 添加此行
(2),【计算机】->【管理】->【服务和应用程序】->【服务】->【MySQL】,停止->启动
(3),修改密码,用户名,root,密码,root
c:\Software_App\mysql-5.7.29-win32\bin>mysql -u root -p # 登陆mysql客户端
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29 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.
mysql> update mysql.user set authentication_string=password("root") where user="root"; # 设置密码,用户名,root,密码,root
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges; # 刷新账户信息
Query OK, 0 rows affected (0.01 sec)
mysql> quit # 退出
Bye
坑:如果提示:You must reset your password using ALTER USER statement before executing this statement.
运行这条语句进行修改密码:alter user user() identified by “root”;
相关链接
https://www.cnblogs.com/xiaxiaoxu/p/8977418.html
2,安装nvicat
2.1 下载nvicat,
https://blog.youkuaiyun.com/u013600314/article/details/80605981