网络技术分享
个人经验记录

mysql下载安装配置 5.7.26 / 5.7.X(免安装版)详细安装教程

1、下载mysql,下载地址:https://downloads.mysql.com/archives/community/

选择操作系统和版本,我是64位win10,点击 Download 下载ZIP Archive版本,我这里下载的  5.7.26 ,基它 5.7.X 的安装都是类似的,没什么区别。

2、下载完成后解压:

3、在mysql目录下手工创建 my.ini 文件,如上图,文件内容如下,basedir 和 datadir 修改为相应地址:

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

4、以管理员身份打开cmd,进入bin目录下,执行 mysqld --initialize-insecure 

c:\mysql-5.7.26-winx64\bin>mysqld --initialize-insecure

5、然后执行 mysqld -install

c:\mysql-5.7.26-winx64\bin>mysqld -install

提示 Service successfully installed ,即安装成功

6、启动服务

c:\mysql-5.7.26-winx64\bin>net start mysql

7、停止服务

c:\mysql-5.7.20-winx64\bin>net stop mysql

8、登录mysql

因为上面初始化参数使用的 --initialize-insecure,所以登录为空密码,直接  mysql -uroot -P3308 即可直接登录:

C\:tools\mysql-5.7.26-winx64\bin>mysql -uroot -P3308
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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>
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql>
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

9、修改mysql 密码:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

完成!

注:如果出现安装mysql Install/Remove of the Service Denied! 报错的时候,在打开 cmd 时用管理员身份打开。

或如下提示也是需管理员身份:Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off

赞(4) 打赏
未经允许不得转载:老麻 » mysql下载安装配置 5.7.26 / 5.7.X(免安装版)详细安装教程

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册