mysql 8.0.16自定义路径安装

今天想安装下mysql的最新版本,并且用自定义安装

首先需要到官网下载压缩包,地址是https://dev.mysql.com/downloads/mysql/

下载完毕后,将其放在想要安装的位置,并进行如下步骤

1.将压缩包解压后,通过cmd进入bin下(最好以管理员方式进入cmd,否可创建服务可能会失败)
2.执行mysqld --initialize --console
成功后输出为:
2019-06-16T09:46:32.373905Z 0 [System] [MY-013169] [Server] D:\IT\MySQL\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server in progress as process 10572
2019-06-16T09:46:32.376010Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-06-16T09:46:59.309326Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *RQxe5FU_Qhp
2019-06-16T09:47:10.056559Z 0 [System] [MY-013170] [Server] D:\IT\MySQL\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server has completed
3.记录root密码(重点)
这是执行2后得到的结果,密码是root@localhost: *RQxe5FU_Qhp    ->*RQxe5FU_Qhp
4.安装服务
mysqld --install [服务名]
此处我输入为:mysqld --install MySQL_8_0_16
成功后输出为:
Service successfully installed.
5.启动服务
net start [服务名]
此处我输入为:net start MySQL_8_0_16
成功后输出为:
MySQL_8_0_16 服务正在启动 ....
MySQL_8_0_16 服务已经启动成功。
6.尝试登陆
mysql -u root -p
然后输入上面记录的root密码即可
成功后输出为:
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16

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>
7.修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
8.创建新用户
// 8.0之前
insert into mysql.user(Host,User,Password) values("%","yes",password("123456"));
// 8.0之后
create user yes identified by '123456';
9.更改权限
grant all privileges on test.* to 'yes'@'%';(test是新建表名)

 

注:其它常用命令可参考:https://blog.csdn.net/a1173356881/article/details/85220577

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值