0

0

Windows 环境通过Virtual Box快速体验TiDB 5.0

蓮花仙者

蓮花仙者

发布时间:2025-07-10 13:20:38

|

738人浏览过

|

来源于php中文网

原创

【免责声明】本文仅代表个人观点,与任何公司无关。

来源公众号|SQL和数据库技术(ID:SQLplusDB)

在Windows环境中,通过Virtual Box快速体验TiDB 5.0

安装虚拟机Virtual Box,安装Oracle Linux 7,配置虚拟机联网,使用TiUP Playground搭建基础测试集群,执行示例,并通过yum安装mysql或客户端。

首先,安装Virtual Box。您可以通过官方网站下载并安装Virtual Box。

https://www.php.cn/link/b16238d06c7888ecb3c3d24d368b1ab8

Windows 环境通过Virtual Box快速体验TiDB 5.0Windows 环境通过Virtual Box快速体验TiDB 5.0接下来,安装Oracle Linux 7。您可以从以下网址下载Oracle Linux 7。

下载Oracle Linux 7
https://www.oracle.com/linux/
文档:
https://docs.oracle.com/en/operating-systems/oracle-linux/7/
https://docs.oracle.com/en/operating-systems/oracle-linux/7/install/

然后,配置虚拟机联网。使用桥接网卡的方式使Virtual Box虚拟机联网。

1.配置虚拟机网络设置

Windows 环境通过Virtual Box快速体验TiDB 5.02.根据本机的IP设置虚拟机的Linux的IP

C:\Users\Administrator>ipconfig
无线局域网适配器 WLAN:
   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : ff80::aa11:2470:41e8:8a50%10
   IPv4 地址 . . . . . . . . . . . . : 192.168.31.16
   子网掩码  . . . . . . . . . . . . : 255.255.255.0
   默认网关. . . . . . . . . . . . . : 192.168.31.1

修改网络配置ifcfg-enp0s3

[root@db12201 ~]# nmcli connection show
名前    UUID                                  タイプ          デバイス
enp0s3  4924bacd-1a6b-412c-9392-29ad24b5fcaa  802-3-ethernet  enp0s3
virbr0  c04be18e-add6-4fd2-ac25-47f45f936a4f  bridge          virbr0
[root@db12201 ~]# cd /etc/sysconfig/network-scripts/
[root@db12201 network-scripts]# ls
ifcfg-enp0s3     ...
[root@db12201 network-scripts]# vi ifcfg-enp0s3
TYPE="Ethernet"
BOOTPROTO=dhcp
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s3"
UUID="4924bacd-1a6b-412c-9392-29ad24b5fcaa"
DEVICE="enp0s3"
ONBOOT="yes"
IPADDR="192.168.31.221"
PREFIX="24"
GATEWAY="192.168.31.1"
DNS1=19.168.31.1

重启网络

羚珑
羚珑

京东推出的一站式AI图像处理平台

下载
$ service network restart

测试连接外网是否成功

[root@db12201 ~]# ping www.baidu.com
PING www.a.shifen.com (110.242.68.4) 56(84) bytes of data.
64 bytes from 110.242.68.4 (110.242.68.4): icmp_seq=1 ttl=53 time=20.3 ms
64 bytes from 110.242.68.4 (110.242.68.4): icmp_seq=2 ttl=53 time=23.5 ms
64 bytes from 110.242.68.4 (110.242.68.4): icmp_seq=3 ttl=53 time=24.6 ms
64 bytes from 110.242.68.4 (110.242.68.4): icmp_seq=4 ttl=53 time=27.3 ms
64 bytes from 110.242.68.4 (110.242.68.4): icmp_seq=5 ttl=53 time=20.5 ms
^C--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 20.356/23.285/27.326/2.612 ms

接着,通过TiUP Playground搭建基础测试集群。

1.下载并安装 TiUP。

# curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh

2.声明全局环境变量。

# source .bash_profile

3.在当前会话中启动集群

# tiup playground

4.在新会话中访问 TiDB 数据库

tiup client
或者
mysql --host 127.0.0.1 --port 4000 -u root

执行示例

[root@db12201 ~]# curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6064k  100 6064k    0     0  3727k      0  0:00:01  0:00:01 --:--:-- 3727k
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /root/.tiup/bin/7b8e153f2e2d0928.root.json
Successfully set mirror to https://tiup-mirrors.pingcap.com
Detected shell: bash
Shell profile:  /root/.bash_profile
/root/.bash_profile has been modified to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
Have a try:     tiup playground
===============================================
[root@db12201 ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export PATH=/root/.tiup/bin:$PATH
[root@db12201 ~]# source .bash_profile
[root@db12201 ~]# tiup playground
The component `playground` version  is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/playground-v1.7.0-linux-amd64.tar.gz 6.46 MiB / 6.46 MiB 100.00% 7.17 MiB/s
Starting component `playground`: /root/.tiup/components/playground/v1.7.0/tiup-playground
Using the version v5.2.2 for version constraint "".
If you'd like to use a TiDB version other than v5.2.2, cancel and retry with the following arguments:
        Specify version manually:   tiup playground 
        Specify version range:      tiup playground ^5
        The nightly version:        tiup playground nightly
Playground Bootstrapping...
The component `prometheus` version v5.2.2 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/prometheus-v5.2.2-linux-amd64.tar.gz 39.84 MiB / 39.84 MiB 100.00% 5.41 MiB/s
download https://tiup-mirrors.pingcap.com/grafana-v5.2.2-linux-amd64.tar.gz 50.00 MiB / 50.00 MiB 100.00% 3.66 MiB/s
Start pd instance
The component `pd` version v5.2.2 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/pd-v5.2.2-linux-amd64.tar.gz 40.10 MiB / 40.10 MiB 100.00% 4.62 MiB/s
Start tikv instance
The component `tikv` version v5.2.2 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tikv-v5.2.2-linux-amd64.tar.gz 165.15 MiB / 165.15 MiB 100.00% 7.82 MiB/s
Start tidb instance
The component `tidb` version v5.2.2 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tidb-v5.2.2-linux-amd64.tar.gz 45.55 MiB / 45.55 MiB 100.00% 9.42 MiB/s
Waiting for tidb instances ready
127.0.0.1:4000 ... Done
Start tiflash instance
The component `tiflash` version v5.2.2 is not installed; downloading from repository.
download https://tiup-mirrors.pingcap.com/tiflash-v5.2.2-linux-amd64.tar.gz 401.44 MiB / 401.44 MiB 100.00% 1.86 MiB/s
failed to download /tiflash-v5.2.2-linux-amd64.tar.gz(download from https://tiup-mirrors.pingcap.com/tiflash-v5.2.2-linux-amd64.tar.gz failed: stream error: stream ID 1; INTERNAL_ERROR; received from peer), retrying...
download https://tiup-mirrors.pingcap.com/tiflash-v5.2.2-linux-amd64.tar.gz 401.44 MiB / 401.44 MiB 100.00% 137.28 MiB/s
Waiting for tiflash instances ready
127.0.0.1:3930 ... Done
CLUSTER START SUCCESSFULLY, Enjoy it ^-^
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4000 -u root -p (no password)
To view the dashboard: http://127.0.0.1:2379/dashboard
PD client endpoints: [127.0.0.1:2379]
To view the Prometheus: http://127.0.0.1:9090
To view the Grafana: http://127.0.0.1:3000

参考:

https://docs.pingcap.com/zh/tidb/stable/quick-start-with-tidb#Linux
TiDB 数据库快速上手指南

最后,通过yum安装mysql或客户端。

# yum list installed mysql*
# yum list | grep mysql
# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-server
# service mysqld start
# systemctl status mysqld.service

参考:

centos7下yum安装mysql
https://blog.csdn.net/wz1226864411/article/details/76146180
https://www.cnblogs.com/brianzhu/p/8575243.html

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
数据分析工具有哪些
数据分析工具有哪些

数据分析工具有Excel、SQL、Python、R、Tableau、Power BI、SAS、SPSS和MATLAB等。详细介绍:1、Excel,具有强大的计算和数据处理功能;2、SQL,可以进行数据查询、过滤、排序、聚合等操作;3、Python,拥有丰富的数据分析库;4、R,拥有丰富的统计分析库和图形库;5、Tableau,提供了直观易用的用户界面等等。

706

2023.10.12

SQL中distinct的用法
SQL中distinct的用法

SQL中distinct的语法是“SELECT DISTINCT column1, column2,...,FROM table_name;”。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

327

2023.10.27

SQL中months_between使用方法
SQL中months_between使用方法

在SQL中,MONTHS_BETWEEN 是一个常见的函数,用于计算两个日期之间的月份差。想了解更多SQL的相关内容,可以阅读本专题下面的文章。

349

2024.02.23

SQL出现5120错误解决方法
SQL出现5120错误解决方法

SQL Server错误5120是由于没有足够的权限来访问或操作指定的数据库或文件引起的。想了解更多sql错误的相关内容,可以阅读本专题下面的文章。

1201

2024.03.06

sql procedure语法错误解决方法
sql procedure语法错误解决方法

sql procedure语法错误解决办法:1、仔细检查错误消息;2、检查语法规则;3、检查括号和引号;4、检查变量和参数;5、检查关键字和函数;6、逐步调试;7、参考文档和示例。想了解更多语法错误的相关内容,可以阅读本专题下面的文章。

360

2024.03.06

oracle数据库运行sql方法
oracle数据库运行sql方法

运行sql步骤包括:打开sql plus工具并连接到数据库。在提示符下输入sql语句。按enter键运行该语句。查看结果,错误消息或退出sql plus。想了解更多oracle数据库的相关内容,可以阅读本专题下面的文章。

798

2024.04.07

sql中where的含义
sql中where的含义

sql中where子句用于从表中过滤数据,它基于指定条件选择特定的行。想了解更多where的相关内容,可以阅读本专题下面的文章。

581

2024.04.29

sql中删除表的语句是什么
sql中删除表的语句是什么

sql中用于删除表的语句是drop table。语法为drop table table_name;该语句将永久删除指定表的表和数据。想了解更多sql的相关内容,可以阅读本专题下面的文章。

422

2024.04.29

Python 自然语言处理(NLP)基础与实战
Python 自然语言处理(NLP)基础与实战

本专题系统讲解 Python 在自然语言处理(NLP)领域的基础方法与实战应用,涵盖文本预处理(分词、去停用词)、词性标注、命名实体识别、关键词提取、情感分析,以及常用 NLP 库(NLTK、spaCy)的核心用法。通过真实文本案例,帮助学习者掌握 使用 Python 进行文本分析与语言数据处理的完整流程,适用于内容分析、舆情监测与智能文本应用场景。

9

2026.01.27

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PostgreSQL 教程
PostgreSQL 教程

共48课时 | 7.9万人学习

Git 教程
Git 教程

共21课时 | 3万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号