windows安装卸载mysql

windows安装卸载mysql,第1张

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

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5673155.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-16
下一篇2022-12-16

发表评论

登录后才能评论

评论列表(0条)

    保存