Mycat 运行与基础操作4
2023-04-18 14:27:33 时间
连接服务
连接方法和mysql一样,里面呈现出的CLI界面也与mysql非常相似
[root@h101 ~]# mysql -u cc -p -P 8066 -h 192.168.100.102
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.8-mycat-1.5-GA-20160217103036 MyCat Server (OpenCloundDB)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
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> show databases;
+----------+
| DATABASE |
+----------+
| cctest |
+----------+
1 row in set (0.01 sec)
mysql> use cctest;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+------------------+
| Tables in cctest |
+------------------+
| catworld |
| catworld4 |
+------------------+
2 rows in set (0.00 sec)
mysql>
创建表
我虽然在mycat里定义了,但在真实库中并没有创建过这两张表
mysql> show tables;
+------------------+
| Tables in cctest |
+------------------+
| catworld |
| catworld4 |
+------------------+
2 rows in set (0.00 sec)
mysql> desc catworld4;
ERROR 1146 (42S02): Table 'my3.catworld4' doesn't exist
mysql>
Tip: 此时在后端真实库里,是找不到这两张表的
这张表是要我们手动创建的,可以有两种方式
- 在每个数据节点里手动创建出一样的数据表
- 直接在mycat里创建,mycat会再分别去各数据节点创建
这里,我使用第二种方式,直接在mycat里创建
mysql> create table catworld4(id int primary key, name varchar(30));
Query OK, 0 rows affected (0.69 sec)
mysql> desc catworld4;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | NO | PRI | NULL | |
| name | varchar(30) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.05 sec)
mysql> explain desc catworld4;
+-----------+----------------+
| DATA_NODE | SQL |
+-----------+----------------+
| sd1 | desc catworld4 |
+-----------+----------------+
1 row in set (0.04 sec)
mysql>
相关文章
- Linux笔记03: Linux常用命令_3.4文件和目录共用命令
- 一些学习编程的优质网站
- Unity初始界面设计与人物移动代码
- linux-磁盘io监控相关工具整理
- 如何用Virtualbox搭建一个虚拟机
- Windows开机自动同步时间
- Linux(安全篇-下)
- Podman与docker兼容性问题
- 高可用linux 服务器搭建
- linux 安装VMware tools
- Microsoft Teams团队频道里共享文件弹出登录提示解决办法
- Windows开启关闭测试模式的方法(含开启测试模式失败的解决办法)
- nginx配置文件,rewrite,if
- nginx配置文件rewrite和if
- Linux 文件系统与日志分析
- 06.构建库函数
- 华为云1核2G云服务器s3实例1M带宽使用体验
- 处理机调度与死锁(二)
- 2022年安装fedora workstation 36之后要安装的软件
- linux绝对路径和相对路径