Creating Databases and Tables
- Connect to the MySQL database and create sysbench databases and users tables.
- Connect to the database dn1.
1 2 3
/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql1.sock create database sysbench; use sysbench;
- Create a table.
1 2 3 4 5 6
CREATE TABLE `users` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL DEFAULT '', `indate` datetime NOT NULL DEFAULT '1900-01-01 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB;
- Connect to the database dn2.
1 2 3
/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql2.sock create database sysbench; use sysbench;
- Create a table.
1 2 3 4 5 6
CREATE TABLE `users` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL DEFAULT '', `indate` datetime NOT NULL DEFAULT '1910-01-01 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB;
- Connect to the database dn3.
1 2 3
/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql3.sock create database sysbench; use sysbench;
- Create a table.
1 2 3 4 5 6
CREATE TABLE `users` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL DEFAULT '', `indate` datetime NOT NULL DEFAULT '1910-01-01 00:00:00', PRIMARY KEY (`id`) ) ENGINE=InnoDB;
- Connect to the database dn1.
Parent topic: Deploying MyCAT Database Sharding