Skip to content

Commit

Permalink
Fixed tutorial to be more copy pasteable
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhaowu committed Aug 13, 2018
1 parent 71ca7bf commit 8014493
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/source/tutorialcopydb.rst
Expand Up @@ -41,15 +41,16 @@ we must first create some test data on the 29291 server to be copied over:

.. code-block:: shell-session
# echo "CREATE DATABASE abc;" >> /tmp/n1create.sql
# echo "CREATE TABLE abc.table1 (id bigint(20) AUTO_INCREMENT, data varchar(16), primary key(id));" >> /tmp/n1create.sql
# echo "CREATE TABLE abc.table2 (id bigint(20) AUTO_INCREMENT, data TEXT, primary key(id));" >> /tmp/n1create.sql
# for i in `seq 1 350`; do
echo "INSERT INTO abc.table1 (id, data) VALUES (${i}, '$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 16)');" >> /tmp/n1create.sql
echo "INSERT INTO abc.table2 (id, data) VALUES (${i}, '$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 16)');" >> /tmp/n1create.sql
done
# mysql --protocol=tcp -u root -P 29291 < /tmp/n1create.sql
# rm /tmp/n1create.sql
# export LC_CTYPE=C # Only need this if you're mac
echo "CREATE DATABASE abc;" > /tmp/n1create.sql
echo "CREATE TABLE abc.table1 (id bigint(20) AUTO_INCREMENT, data varchar(16), primary key(id));" >> /tmp/n1create.sql
echo "CREATE TABLE abc.table2 (id bigint(20) AUTO_INCREMENT, data TEXT, primary key(id));" >> /tmp/n1create.sql
for i in `seq 1 350`; do
echo "INSERT INTO abc.table1 (id, data) VALUES (${i}, '$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 16)');" >> /tmp/n1create.sql
echo "INSERT INTO abc.table2 (id, data) VALUES (${i}, '$(cat /dev/urandom | tr -cd 'a-z0-9' | head -c 16)');" >> /tmp/n1create.sql
done
mysql --protocol=tcp -u root -P 29291 < /tmp/n1create.sql
rm /tmp/n1create.sql
This created two tables under the database ``abc``. We will be moving
``table1`` to 29292 while not copying 29291.
Expand Down

0 comments on commit 8014493

Please sign in to comment.