Вопрос что не так?
Как делал:
master_db - база мастера.
slave_db - слейва.
1 и 4:
скрипт баш
Code: Select all
#!/bin/bash
DB_USER="user_1"
DB_PASS="MyPassword"
DB_NAME="master_db"
# Get all tables starting with 'rot_' from the master_db
tables=$(mysql -u$DB_USER -p$DB_PASS -N -e "SELECT table_name FROM information_schema.tables WHERE table_schema='$DB_NAME' AND table_name LIKE 'rot_%';")
# Dump each table into a file and load it into slave_db
for table in $tables
do
echo "Dumping $table from $DB_NAME..."
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME $table > $table.sql
echo "Loading $table into slave_db..."
mysql -u$DB_USER -p$DB_PASS slave_db < $table.sql
echo "$table successfully transferred to slave_db."
doneномер слейва 15, он единственный у мастера.
3
отсоединяем слейв.
5
DROP TABLE rot_gallery_stats1;
6
RENAME TABLE rot_gallery_stats15 TO rot_gallery_stats1;
7
В админке слейва удаляю "слейв".







