薅OBCP考试券的社区活动
https://ask.oceanbase.com/t/topic/35600926
本次实验目的:掌握从 MySQL 向 OceanBase 迁移数据的基本方法:mysqldump、datax 、canal 等。
一、mysql环境准备
OceanBase所在的环境中没有mysql环境,使用docker搭一个。
并开启远程访问
grant all privileges on . to ‘root’@‘%’;
flush privileges;
docker pull mysql
docker run -d -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=Admin123 -v mysql_data:/var/lib/mysql mysql --lower-case-table-names=1
docker exec -it mysql bash
grant all privileges on *.* to 'root'@'%';
flush privileges;
bash-4.4# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.3.0 MySQL Community Server - GPL
Copyright (c) 2000, 2024, 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.
grant all privileges on *.* to 'root'@'%';
flush privileges;
创建测试表
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| testdb |
+--------------------+
5 rows in set (0.00 sec)
mysql> use testdb
Database changed
mysql> create table tb_mysql2ob(id int,name varchar(100));
Query OK, 0 rows affected (1.36 sec)
mysql> insert into tb_mysql2ob(id,name) values(1,'Tom');
Query OK, 1 row affected (0.16 sec)
mysql