Running TiDB
- Copy the executable files to the specified directory. (This step is required only for installing TiDB from source code.)
1 2 3
cp /home/pd/bin/pd-server /data/bin cp /home/tikv/target/debug/tikv-server /data/bin cp /home/tidb/bin/tidb-server /data/bin
- Install the MySQL client.
1yum -y install mysql

- Start the TiDB service.
1 2
cd /data/bin ./pd-server --data-dir=pd --log-file=pd.log & ./tikv-server --pd='127.0.0.1:2379' --data-dir=tikv --log-file=tikv.log & ./tidb-server --store=tikv --path='127.0.0.1:2379' --log-file=tidb.log &

- Test the connection.
Wait for about 1 minute and connect to the database. If the connection is successful, TiDB functions properly.
1mysql -h 127.0.0.1 -u root -P 4000

- Check the TiDB version.
1select tidb_version()\G

- Create a TiDB database.
1 2
create database TiDB; use TiDB;

- Create a tab_tidb table.
1 2 3 4 5 6 7
CREATE TABLE `tab_tidb` ( \ `id` int(11) NOT NULL AUTO_INCREMENT, \ `name` varchar(20) NOT NULL DEFAULT '', \ `age` int(11) NOT NULL DEFAULT 0, \ `version` varchar(20) NOT NULL DEFAULT '', \ PRIMARY KEY (`id`), \ KEY `idx_age` (`age`));

- Insert data.
1insert into `tab_tidb` values (1, 'TiDB', 5, 'TIDB-v3.0.13');
- View the result.
1select * from tab_tidb;

- Delete data.
1delete from `tab_tidb` where name='TiDB';
- View the result.
1select * from tab_tidb;

- Check the TiKV Store status, store_id, storage status, and startup time.
1select STORE_ID,ADDRESS,STORE_STATE,STORE_STATE_NAME,CAPACITY,AVAILABLE,UPTIME from INFORMATION_SCHEMA.TIKV_STORE_STATUS;

- Exit the database.
1exit;
Parent topic: Installation Guide