# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M
# Remove leading # to revert to previous value for default_authentication_plugin, # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password skip-host-cache skip-name-resolve datadir=/var/lib/mysql socket=/var/run/mysqld/mysqld.sock secure-file-priv=/var/lib/mysql-files user=mysql
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M
# Remove leading # to revert to previous value for default_authentication_plugin, # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password skip-host-cache skip-name-resolve datadir=/var/lib/mysql socket=/var/run/mysqld/mysqld.sock secure-file-priv=/var/lib/mysql-files user=mysql
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
[mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M
# Remove leading # to revert to previous value for default_authentication_plugin, # this will increase compatibility with older clients. For background, see: # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin # default-authentication-plugin=mysql_native_password skip-host-cache skip-name-resolve datadir=/var/lib/mysql socket=/var/run/mysqld/mysqld.sock secure-file-priv=/var/lib/mysql-files user=mysql
# 创建复制用户 CREATE USER 'replica'@'%' IDENTIFIED BY '123'; # 授予复制权限 GRANT REPLICATION SLAVE ON *.* TO replica@'%'; # 更改验证方式为本地密码验证 ALTER USER 'replica'@'%' IDENTIFIED WITH mysql_native_password BY '123'; # 刷新权限 FLUSH PRIVILEGES; -- 查看主服务器状态,记录File和Position值 SHOW MASTER STATUS;
# 创建复制用户 CREATE USER 'replica'@'%' IDENTIFIED BY '123'; # 授予复制权限 GRANT REPLICATION SLAVE ON *.* TO replica@'%'; # 更改验证方式为本地密码验证 ALTER USER 'replica'@'%' IDENTIFIED WITH mysql_native_password BY '123'; # 刷新权限 FLUSH PRIVILEGES; -- 查看主服务器状态,记录File和Position值 SHOW MASTER STATUS;
# 创建数据库和数据表并新增数据,在其他从属数据库查看复制状态 create DATABASE `db_01`; use db_01; CREATE TABLE tb_user( id int(11) AUTO_INCREMENT PRIMARY key not null , name varchar(50) not null )ENGINE = INNODB DEFAULT CHARSET=utf8mb4; # 插入数据 insert into tb_user(id,name)VALUES(null,'Tom'),(null,'Jerry'); # 修改数据 update tb_user set name='Peter' where id =1; # 删除数据 delete from tb_user where id = 2;
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# # The MySQL Server configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql #log-error = /var/log/mysql/error.log # By default we only accept connections from localhost #bind-address = 127.0.0.1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# # The MySQL Server configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql #log-error = /var/log/mysql/error.log # By default we only accept connections from localhost #bind-address = 127.0.0.1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# # The MySQL Server configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql #log-error = /var/log/mysql/error.log # By default we only accept connections from localhost #bind-address = 127.0.0.1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
# 创建复制用户 CREATE USER 'replica'@'%' IDENTIFIED BY '123'; # 授予复制权限 GRANT REPLICATION SLAVE ON *.* TO replica@'%'; # 更改验证方式为本地密码验证 ALTER USER 'replica'@'%' IDENTIFIED WITH mysql_native_password BY '123'; # 刷新权限 FLUSH PRIVILEGES; -- 查看主服务器状态,记录File和Position值 SHOW MASTER STATUS;
# 创建复制用户 CREATE USER 'replica'@'%' IDENTIFIED BY '123'; # 授予复制权限 GRANT REPLICATION SLAVE ON *.* TO replica@'%'; # 更改验证方式为本地密码验证 ALTER USER 'replica'@'%' IDENTIFIED WITH mysql_native_password BY '123'; # 刷新权限 FLUSH PRIVILEGES; -- 查看主服务器状态,记录File和Position值 SHOW MASTER STATUS;
# 创建数据库和数据表并新增数据,在其他从属数据库查看复制状态 create DATABASE `db_01`; use db_01; CREATE TABLE tb_user( id int(11) AUTO_INCREMENT PRIMARY key not null , name varchar(50) not null )ENGINE = INNODB DEFAULT CHARSET=utf8mb4; # 插入数据 insert into tb_user(id,name)VALUES(null,'Tom'),(null,'Jerry'); # 修改数据 update tb_user set name='Peter' where id =1; # 删除数据 delete from tb_user where id = 2;