超级详细Mysql安装步骤图解

时间:2022-06-07 05:29:33

数据库忘记装了,然后今天才装上。刚开始有点蒙蔽,进入mysql官网一堆英文,小声逼逼没有学号英语的我。废话不都说,直接上图

1、输入网址 https://www.mysql.com/downloads/

超级详细Mysql安装步骤图解

 

2、点击Mysql Community Server

超级详细Mysql安装步骤图解

 

 

 3、进去之后是最新版本,点击图上按钮就可以下载之前版本

超级详细Mysql安装步骤图解

 

 

 4、下载zip安装包然后就可以了

5、记得进行配置,找到你安装mysql的文件夹中

1)在bin同级目录创建新建my-default.ini文件。我的ini文件是这样的:

[mysqld]
 
#设置3306端
 
port = 3306
 
# 设置mysql的安装目录
 
basedir=D:devUtilsJavamysql-5.7.28-winx64
 
# 设置mysql数据库的数据的存放目录
 
datadir=D:devUtilsJavamysql-5.7.28-winx64data
 
# 允许最大连接数
 
max_connections=200
 
# 服务端使用的字符集默认为8比特编码的latin1字符集
 
character-set-server=utf8
 
# 创建新表时将使用的默认存储引擎
 
default-storage-engine=INNODB
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
[mysql]
 
# 设置mysql客户端默认字符集
 
default-character-set=utf8

2)bin目录下创建my.ini文件

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. Its a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
 
[mysqld]
 
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
 
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
 
# These are commonly set, remove the # and set as required.
basedir = D:devUtilsJavamysql-5.7.28-winx64
datadir = D:devUtilsJavamysql-5.7.28-winx64data
port = 3306
# server_id = .....
 
 
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

6、运行mysql

以管理员身份运行cmd,win10菜单栏里找到

超级详细Mysql安装步骤图解

 

 

依次执行命令:mysqld --install

          mysqld --initialize

          net startt mysql

超级详细Mysql安装步骤图解

 

7、登录mysql 

  mysql -uroot -p

超级详细Mysql安装步骤图解

 

 

 刚开始时,你随机输入会提示错误,不要慌。去我们刚才配置的data目录下找到一个.err的文件

超级详细Mysql安装步骤图解

 

 

 输入密码后就成功登录了。

8、修改mysql密码

   1)如果你此时进入到mysql中,使用exit退出

   2)net stop mysql 停止mysql服务

      3)mysqld --skip-grant-tables 使用无验证方式启动mysql服务

      4)使用管理员权限打开新的cmd命令行窗口,输入mysql  你就可以无密码进入到mysql中

    5)use mysql   

       6)UPDATE user SET authentication_string = PASSWORD(‘新密码‘) WHERE user = ‘root‘;

再次登录使用设置的新密码就可以了!

 希望能够帮到大家!!!