8)、修改MySQL的root用户的密码:
 
# mysql -u root mysql
 
mysql>use mysql;
 mysql>desc user;
 mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";  //为root添加远程连接的能力。
 mysql>update user set Password = password('xxxxxx') where User='root';
 mysql>select Host,User,Password  from user where User='root';
 mysql>flush privileges;
 mysql>exit
 
重新登录:mysql -u root -p

 

 

数据库备份
mysqldump -h ip -u root -p TestDB > TestDB.sql

mysql -hlocalhost -uroot -p123456 TestDB < TestDB.sql

show databases;
 TestDB;
create database TestDB;
source TestDB.sql;
use db2
show tables;


=============================================================

server-id=1 
log-bin = /usr/local/mysql/logs/sql-bin

show master status;

change master to

   -> master_host='192.168.1.254',

   -> master_user='repl',

   -> master_password='12345',

   -> master_log_file='sql-bin.000001',

   -> master_log_pos=120;

start slave;
===============================================================http://hypocritical.blog.51cto.com/3388028/1404210===================