Bookmark and Share
useful command line
(Publish Date: 2009-9-10 11:55am, Total Visits: 1324, Today: 1, This Week: 1, This Month: 3)

-- change master command:

change master to master_host='host1',
master_user='repl',
master_password ='xxxxx',
master_port = 3306,
master_log_file='db-bin.000649',
master_log_pos = xxx;

-- skip one transaction for a slave:

SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1
START SLAVE SQL_THREAD;

-- turn-on-read-write

show variables like 'read_only';
set global read_only = off;

-- change-to-read-only

set global read_only = on;
show variables like 'read_only';

 

-- change mysql user's password

1.$ mysqladmin -u user_name -p oldpassword password newpass
2. mysql>set password for user_name@'%' = password('new password');
3.  mysql> update user set password=PASSWORD("NEWPASSWORD") where User='user_name';

 

-- To change your own password, the syntax is:


Mysql> SET PASSWORD = PASSWORD('newpassword');

 

-- change mysql root's password

1. $ mysqladmin -u root -p'oldpassword' password newpass
2. mysql> update user set password=PASSWORD("NEWPASSWORD") where User='root';
   mysql> flush privileges;

-- disable binlog for the current session

SET sql_log_bin = 0;