mysql非安装版本配置过程

原创
09/13 15:28
阅读数 66

【第一步】下载mysql非安装解压包mysql-8.0.33-winx64.zip,解压到本地(C:\MySql\mysql-8.0.33)网址:https://dev.mysql.com/downloads/file/?id=518220;

【第二步】解压到本地,配置环境变量:双击此电脑(进入)—> 空白处右击,选择属性—>点击高级系统设置—>点击环境变量(进入)—>编辑用户变量Path—>添加mysql的bin路径(我的解压路径是C:\MySql\mysql-8.0.33,path添加 C:\MySql\mysql-8.0.33\bin);

【第三步】C:\MySql\mysql-8.0.33路径下新建my.ini文件,编辑内容如下:

[client]

#客户端端口号为3306

port=3306

default-character-set=utf8

[mysqld]

basedir=C:\MySql\mysql-8.0.33\

datadir=C:\MySql\mysql-8.0.33\data\

port=3306

shared-memory

skip-grant-tables

# skip-grant-tables:跳过用户验证

# basedir和datadir需要手动改为自己实际的路径

【第四步】初始化mysql

C:\Users\Administrator>cd C:\MySql\mysql-8.0.33-winx64\bin

C:\MySql\mysql-8.0.33-winx64\bin> mysqld install

C:\MySql\mysql-8.0.33-winx64\bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

mysql> alter user 'root'@'localhost' identified by '123456';

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

mysql> flush privileges;

Query OK, 0 rows affected (0.03 sec)

mysql> alter user 'root'@'localhost' identified by '123456';

Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.04 sec)

C:\MySql\mysql-8.0.33\bin>net stop mysql

MySQL 服务正在停止.

MySQL 服务已成功停止。

【第五步】注释掉my.ini文件中的skip-grant-tables

C:\MySql\mysql-8.0.33\bin>net start mysql

MySQL 服务正在启动 .

MySQL 服务已经启动成功。

C:\MySql\mysql-8.0.33\bin>mysql -u root -p

Enter password: ******  (上边设置的密码 123456)

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.33 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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>(这里就可以正常使用了)

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部