栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

windows安装卸载mysql

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

windows安装卸载mysql

下载mysql社区版

下载地址:https://dev.mysql.com/downloads/mysql/
解压文件到本地,比如 D:UPUPW_NP7.2_64mysql-8.0.27-winx64

安装

1、管理员权限执行cmd ,目录切换到bin目录

D:UPUPW_NP7.2_64mysql-8.0.27-winx64>cd bin

2、初始化mysql,注意这里有随机的root密码

D:UPUPW_NP7.2_64mysql-8.0.27-winx64bin>mysqld --initialize --console
2021-12-15T06:04:16.006509Z 0 [System] [MY-013169] [Server] D:UPUPW_NP7.2_64mysql-8.0.27-winx64binmysqld.exe (mysqld 8.0.27) initializing of server in progress as process 27640
2021-12-15T06:04:16.034814Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-15T06:04:17.854324Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-12-15T06:04:20.038927Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-12-15T06:04:20.039075Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-12-15T06:04:20.216804Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: gua?gC,ZS15z

3、执行安装

D:UPUPW_NP7.2_64mysql-8.0.27-winx64bin>mysqld -install
Service successfully installed.

4、启动mysql服务

D:UPUPW_NP7.2_64mysql-8.0.27-winx64bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

5、注册mysql服务为windows服务

sc stop mysql

6、登录mysql

D:UPUPW_NP7.2_64mysql-8.0.27-winx64bin>mysql -uroot -pgua?gC,ZS15z
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 12
Server version: 8.0.27

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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、修改用户名、以及允许远程访问

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.02 sec)
mysql> use mysql
Database changed
mysql> update user set host="%" where user="root";
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select host,user from user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | root             |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
+-----------+------------------+
4 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql>
卸载mysql
net stop mysql
sc delete mysql
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/667898.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号