MySQL Install and uninstall master-slave configuration

Source: Internet
Author: User
Tags change settings

1. Query Rpm-qa | grep mysql* Components
A similar installation package appears
Mysql-server-5.1.71-1.el6.x86_64

Mysql-libs-5.1.71-1.el6.x86_64

Mysql-connector-odbc-5.1.5r1144-7.el6.x86_64

Mysql-5.1.71-1.el6.x86_64

Mysql-devel-5.1.71-1.el6.x86_64

2. Uninstall the system installed MySQL, remove the Lib package

Yum Remove Mysql-libs

3. Check whether to uninstall the full

Rpm-qa | grep mysql*
No software decision has been uninstalled completely

3. User

Groupadd MySQL
useradd-d/mnt/mysql-g MySQL MySQL

passwd MySQL

--Enter Password two times

4. Copy the configuration file before installing MySQL

4. Installing Mysql,/usr/soft

rpm-ivhmysql-server-5.6.32-1.linux_glibc2.5.x86_64.rpm

rpm-ivhmysql-client-5.6.32-1.linux_glibc2.5.x86_64.rpm

4. my.cnf file

# for advice the change settings pleasesee

#http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[Client]

#password =123456

port=3306

Socket=/mnt/mysql/mysql.sock

Default-character-set=utf8

[Mysqld]

Character-set-server=utf8

Lower_case_table_names=1

# Remove Leading # to turn on a very importantdata integrity option:logging

# Changes to the binary log between backups.

Log_bin=mysql-bin

#主机配置

#主机运行命令GRANTREPLICATION SLAVE on * * to ' sqlsync ' @ '% ' identified by ' 123456 ';

#read-only=0 #主机, reading and writing can

#binlog-do-db =test #需要备份数据, more than one line of writing

#binlog-ignore-db =mysql #不需要备份的数据库, more than one line of writing

# These is commonly set, remove the # and SETAs required.

#basedir =/mnt/mysql

DataDir =/mnt/mysql

Port = 3306

server_id = 1

#服务器唯一ID, the default is 1, usually take IP last paragraph

Socket =/mnt/mysql/mysql.sock

max_connections=1000

# Remove Leading # to set options mainly usefulfor reporting servers.

# The server defaults is faster fortransactions and fast selects.

# Adjust sizes as needed, experiment to findthe optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

#从机配置, the host does not need to be opened

#master-host=192.168.229.129

#master-user=mysnyc

#master-pass=123456

#master-port=3306

#master-connect-retry=60 #如果从服务器发现主服务器断掉, the time difference of reconnection (in seconds)

#replicate-do-db =test #只复制某个库

#replicate-ignore-db=mysql #不复制某个库

Log-slave-updates=on

Sync_binlog=1

auto_increment_offset=2

#便于区分, the ServerID is set to 1 of 1 for 2 to 2

auto_increment_increment=2

Slave-skip-errors=all

Sql_mode=no_engine_substitution,strict_trans_tables

[MySQL]

Default-character-set=utf8

4. Change the root password

Su–mysql

Can not start this statement, enter/root/.mysql_secret see root password login
--mysqld_safe--user=root--skip-grant-tables--skip-networking &--omitted

Servicemysql start


--mysql-u root mysql--omit

Use this statement

Mysql–u root–p

Enter a default password

Modify the default password set password = password ("123456");

Mysql>use MySQL;
mysql> UPDATE user SET Password=password (' 123456 ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit

Servicemysql restart
Mysql-uroot-p

Enter Password: < Enter the newly set password newpassword>

Quit

----------install and set up successfully

#如果提示ERROR 1820 (HY000): You must SET PASSWORD before Executingthis statement

#需要重新设置密码

Set Password =password ("123456");

Uninstall MySQL

Yum Remove Mysql-libs

Find the MySQL installation package

Rpm–qa|grep–i MySQL

Stop MySQL Service

Service MySQL Stop

Rpm-emysql-client-5.6.32-1.linux_glibc2.5.x86_64

Rpm-emysql-server-5.6.32-1.linux_glibc2.5.x86_64

Delete some mysql-generated files

Find/-name MySQL

Rm–rf ...

Master-Slave configuration:

Configure Master MySQL

Grantreplication SLAVE on * * to ' mysync ' @ '% ' identified by ' 123456 ';

Show master status;

Configuration from MySQL

Stop slave;//Stops

Change Master tomaster_host= ' 10.46.181.107 ', master_user= ' Mysync ', master_password= ' 123456 ', master_port=3306, Master_connect_retry=10,master_log_file= ' mysql-bin.000004 ', master_log_pos=325;

Start slave;

Show slave status\g//View status

(The main owner is just the opposite configuration)

Report:

Create user and attach all permissions

Grantall Privileges On * * to ' bwcloud ' @ '% ' identified by ' 123456 ';

Flushprivileges;

MySQL Install and uninstall master-slave configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.