mysql-8.0.27-winx64.zip 安装
一、预备工作
1、下载地址:https://dev.mysql.com/downloads/mysql/
2、下载版本:mysql-8.0.27-winx64.zip(大小:209.4MB;不是debug版本);
二、mysql数据库的安装
1、建立mysql的安装目录:D: oolsdbmysql8027
2、建立数据存放文件夹:D: oolsdbmysql_data
3、将“mysql-8.0.27-winx64.zip”,解压至 “D: oolsdbmysql8027”
4、增加“系统环境变量”:path=D: oolsdbmysql8027in
5、配置文件:my.ini(D: oolsdbmysql8027)
[mysqld]
basedir=D:/tools/db/mysql8027
datadir=D:/tools/db/mysql_data
default_authentication_plugin=mysql_native_password
6、开启cmd命令;
7、数据库初始化:
C:UsersAdministrator>mysqld --initialize --console
2021-11-03T16:20:32.125572Z 0 [System] [MY-013169] [Server] D: oolsdbmysql8027inmysqld.exe (mysqld 8.0.27) initializing of server in progress as process 9628
2021-11-03T16:20:33.760967Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-11-03T16:20:42.238252Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-11-03T16:21:00.148851Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-11-03T16:21:00.151989Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-11-03T16:21:01.518820Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: reLLh;Cr*3GD //初始化密码
C:UsersAdministrator>
8、安装服务:mysql
C:UsersAdministrator>mysqld --install [服务名]
C:UsersAdministrator>mysqld --install mysql
9、启动mysql服务:
C:UsersAdministrator>net start mysql
10、用初始化密码登录mysql数据库:
C:UsersAdministrator>mysql -uroot -p
Enter password: (初始密码)reLLh;Cr*3GD
11、修改密码:
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '新密码';
12、常用的语句:
-- 权限查询: select user, host, authentication_string from mysql.user;
-- 建立新用户: create user 'admin'@'localhost' identified with mysql_native_password by 'xx';
-- 授权新用户: grant all on *.* to 'admin'@'localhost' with grant option;
三、数据库卸载:
1、停止mysql服务:
C:UsersAdministrator>net stop mysql
2、移除mysql服务:
C:UsersAdministrator>mysqld --remove
3、删除安装位置的文件夹:
删除文件夹:D: oolsdbmysql8027