2.配置环境变量:我的电脑->属性->高级系统设置->环境变量->系统变量->Path:新增MySQL解压文件中bin的路径(D:mysql-8.0.11bin)
3.在解压的文件夹(D:mysql-8.0.11)中新建名为data的文件夹和名为my.ini 的文件,打开my.ini,写入下面的配置:
[mysqld]
#setbasedir to your installation path 设置解压文件mysql文件夹的路径(D:/mysql-8.0.11 -->将此处替换为自己的路径)
basedir=D:/mysql-8.0.11#setdatadir to the location of your data directory 设置刚才创建data文件夹的路径(D:/mysql-8.0.11/data -->将此处替换为自己的路径)
datadir=D:/mysql-8.0.11/data
4.安装mysql,管理员身份打开cmd命令框切换到 D:mysql-8.0.11目录下输入 :
D:mysql-8.0.11>binmysqld --initialize-insecure
D:mysql-8.0.11>binmysqld --install
5.启动mysql,先切换到bin目录下,然后输入net start mysql (停止服务:net stop mysql):
D:mysql-8.0.11bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
6.登陆mysql并修改密码(此方法安装初始密码为空,输入 mysql -u root 即可登陆,修改密码:alter user 'root'@'localhost'identified by '123456';):
D:mysql-8.0.11bin>mysql -u rootWelcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection idis 8Server version:8.0.11 MySQL Community Server -GPL
Copyright (c)2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracleis 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> alter user 'root'@'localhost'identified by '123456';
至此,mysql数据路已安装好了。
其他问题:
(1).远程连接
b.可能需要重新设置修改密码的方式,登陆mysql:
mysql> alter user 'root'@'%'identified with mysql_native_password by '12340';Query OK,0 rows affected (0.05sec)
mysql> flush privileges;
内容来源于网络如有侵权请私信删除