栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

win11安装mysql8最新版

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

win11安装mysql8最新版

win11安装mysql8最新版 1、下载mysql

2、解压

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

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

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

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

net start mysql

net stop mysql

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

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

4、登录服务器
D:softmysql-8.0.29bin>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:softmysql-8.0.29 | D:softmysql-8.0.29data | 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:softmysql-8.0.29bin>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

7、linux docker mysql 连接登录win mysql

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

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

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

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