lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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:\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(D:\tools\db\mysql8027)
[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 '新密码';

  mysql> alter user 'root'@'localhost' identified by '新密码';       // (version: mysql-8.0.31)

  MariaDB [(none)]> create user 'admin'@'192.168.1.%' identified  by  'mima';  //  ‘%’:通配符,代表“任意的字符串”。

 

 


12、常用的语句:

 

  -- 查看所有用户:  select   user,  host   from   mysql.user;

 

  -- 建立新用户:  create user 'admin'@'ip' identified with mysql_native_password by 'xx';

 

  -- 删除用户:  drop user  'admin'@ip;   

 

  -- 授权新用户:  grant all on *.* to 'admin'@'ip' with grant option;

 

  -- 权限查询:  select user, host, authentication_string from mysql.user;  show grants for 'admin'@'ip';

  

 

 

 

 

 

 

三、数据库卸载:

 

 


1、停止mysql服务:


    C:\Users\Administrator>net stop mysql

 

2、移除mysql服务:

    C:\Users\Administrator>mysqld --remove  [服务名]

    C:\Users\Administrator>mysqld --remove  mysql

 

3、删除安装位置的文件夹:

    删除文件夹:D:\tools\db\mysql8027

 

 

posted on 2021-11-04 03:14  lnlidawei  阅读(2245)  评论(0编辑  收藏  举报