MySQL在Windows安装的步骤和问题

198 阅读1分钟

解压完毕之后执行命令出现: # Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)

解决办法:

以管理员身份运行cmd

  1. D:\software\mysql-8.0.30-winx64\bin>mysqld --remove mysql Service successfully removed.

需要手动把data文件夹和my.ini文件删除了

  1. D:\software\mysql-8.0.30-winx64\bin>mysqld --install #安装MySQL

Service successfully installed.

  1. D:\software\mysql-8.0.30-winx64\bin>mysqld --initialize --user=root --console

2022-08-11T02:30:26.613109Z 0 [System] [MY-013169] [Server] D:\software\mysql-8.0.30-winx64\bin\mysqld.exe (mysqld 8.0.30) initializing of server in progress as process 1688 2022-08-11T02:30:26.627780Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2022-08-11T02:30:27.258246Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2022-08-11T02:30:28.108220Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 3_)9NiT/bkFa

  1. D:\software\mysql-8.0.30-winx64\bin>net start mysql # 启动服务

MySQL 服务正在启动 . MySQL 服务已经启动成功。

  1. D:\software\mysql-8.0.30-winx64\bin>mysql -u root -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.30

Copyright (c) 2000, 2022, 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> set password='12345678';

Navicat显示client does not support authentication protocol request

1、cmd进入命令提示符,一直找到MySQL安装路径,我的是

D:\Program Files (x86)\MySQL\MySQL server 8.0\bin

2、输入 mysql -u root -p

此时会提示你输密码,输入MySQL密码,从而由DOS进入MySQL

3、输入

use mysql

      再输入

alter user 'root'@'localhost' identified with mysql_native_password by '你的密码';

      再输入

flush privileges;