win11安装mysql8最新版

win11安装mysql8最新版

1、下载mysql

image-20220511152503727

image-20220511152547698

image-20220511152719094

image-20220511152352570

2、解压

image-20220511153647259

3、初始化数据库并安装启动服务

以管理员身份打开CMD命令控制台

image-20220511154233981

mysqld --initialize-insecure 初始化,会自动的在D:\soft\mysql-8.0.29建立目录/data

image-20220511160204533

mysqld install 安装服务,服务名称为mysql

net start mysql

net stop mysql

net 是windows系统的服务管理命令

image-20220511160334589

如果要通过窗口查看服务,在运行中可以输入services.msc 打开服务窗口

image-20220511160641383

4、登录服务器

D:\soft\mysql-8.0.29\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, 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> select @@hostname,@@port,@@version,@@basedir,@@datadir,now();
+------------+--------+-----------+-----------------------+----------------------------+---------------------+
| @@hostname | @@port | @@version | @@basedir             | @@datadir                  | now()               |
+------------+--------+-----------+-----------------------+----------------------------+---------------------+
| summer     |   3306 | 8.0.29    | D:\soft\mysql-8.0.29\ | D:\soft\mysql-8.0.29\data\ | 2022-05-11 16:09:59 |
+------------+--------+-----------+-----------------------+----------------------------+---------------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql>

创建mysql账号并授权

mysql> create user admin identified with mysql_native_password by 'admin';
Query OK, 0 rows affected (0.02 sec)

mysql> grant all on *.* to admin;
Query OK, 0 rows affected (0.01 sec)

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

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

mysql>

5、windows mysql 连接ubuntu docker mysql

D:\soft\mysql-8.0.29\bin>mysql -h192.168.1.112 -uroot -p -P49155
Enter password: ***
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.51 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, 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> select @@hostname,@@port,@@basedir,@@datadir;
+--------------+--------+-----------+-----------------+
| @@hostname   | @@port | @@basedir | @@datadir       |
+--------------+--------+-----------+-----------------+
| c891a3aa1a28 |   3306 | /usr/     | /var/lib/mysql/ |
+--------------+--------+-----------+-----------------+
1 row in set (0.01 sec)

mysql>

6、sqlyog 连接win mysql

image-20220511143401417

image-20220511143516818

7、linux docker mysql 连接登录win mysql

docker run -it --rm mysql:8.0.29 mysql -h192.168.0.121 -uadmin -p
注意要关闭Windows防火墙

image-20220511144350497

image-20220511144316337

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Windows 11安装MySQL,可以按照以下步骤进行操作: 1. 首先,下载MySQL安装程序,可以从官方网站上获取最新版本的MySQL。考虑到稳定性和可靠性,建议选择MySQL 5.7系列。 2. 运行下载的MySQL安装程序,选择自定义安装。 3. 在安装选项中,选择安装MySQL Servers 5.7版本,并将其添加到右侧的选中框中。 4. 点击“Advanced Options”按钮,选择安装位置,并继续安装过程。 5. 在安装过程中,设置MySQL的密码,并完成安装。 6. 安装完成后,可以在开始菜单中搜索MySQL,并打开命令行界面。 7. 在命令行界面中,输入MySQL的密码,确认是否成功安装。 8. 为了方便使用MySQL,还需要配置环境变量。找到MySQL安装路径,然后在系统变量中选择“Path”,编辑该变量,将MySQL的路径添加进去。 9. 验证配置是否成功,可以在运行窗口中输入cmd,打开命令行界面,然后输入mysql -u root -p命令,输入密码,确认是否成功进入MySQL的操作管理界面。 总结一下,Win11安装MySQL的步骤如下: 1. 下载并运行MySQL安装程序 2. 选择自定义安装安装MySQL Servers 5.7版本 3. 设置密码并完成安装 4. 配置环境变量 5. 验证安装是否成功 以上是一种基本的安装步骤,根据不同的版本和个人需求可能会有所不同。请根据具体情况进行操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值