mysql-8.0.27-winx64.zip 安装
一、mysql数据库的安装
1、建立mysql的安装目录:D:\tools\db\mysql8027
2、建立数据存放文件夹:D:\tools\db\mysql_data
3、将“mysql-8.0.27-winx64.zip”,解压至 “D:\tools\db\mysql8027”
4、增加“系统环境变量”:path=D:\tools\db\mysql8027\bin
5、配置my.ini
[mysqld]
basedir=D:/tools/db/mysql8027
datadir=D:/tools/db/mysql_data
default_authentication_plugin=mysql_native_password
6、开启cmd命令;
7、数据库初始化:
C:\Users\Administrator>mysqld --initialize --console
2021-11-03T16:20:32.125572Z 0 [System] [MY-013169] [Server] D:\tools\db\mysql8027\bin\mysqld.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:\Users\Administrator>
8、安装服务:mysql
C:\Users\Administrator>mysqld --install [服务名]
C:\Users\Administrator>mysqld --install mysql
9、启动mysql服务:
C:\Users\Administrator>net start mysql
10、用初始化密码登录mysql数据库:
C:\Users\Administrator>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:\Users\Administrator>net stop mysql
2、移除mysql服务:
C:\Users\Administrator>mysqld --remove
3、删除安装位置的文件夹:
删除文件夹:D:\tools\db\mysql8027