主主复制
192.168.59.129 试验过程 二进制安装mysql
login as: root
┌────────────────────────────────────────────────────────────────────┐
│ • MobaXterm 10.2 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to root@192.168.59.129 │
│ • SSH compression : ✔ │
│ • SSH-browser : ✔ │
│ • X11-forwarding : ✘ (disabled or not supported by server) │
│ • DISPLAY : 192.168.254.25:0.0 │
│ │
│ ➤ For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Mon Jul 22 03:24:36 2019
[root@root ~]#
[root@root ~]# yum -y install ntp ntpdate
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-28.el7.centos will be installed
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-28.el7.centos.x8 6_64
---> Package ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2 will be updated
---> Package ntpdate.x86_64 0:4.2.6p5-28.el7.centos will be an update
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================
Package Arch Version Repository Size
===========================================================================================
Installing:
ntp x86_64 4.2.6p5-28.el7.centos base 549 k
Updating:
ntpdate x86_64 4.2.6p5-28.el7.centos base 86 k
Installing for dependencies:
autogen-libopts x86_64 5.18-5.el7 base 66 k
Transaction Summary
===========================================================================================
Install 1 Package (+1 Dependent package)
Upgrade 1 Package
Total download size: 701 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00
(2/3): ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm | 86 kB 00:00:00
(3/3): ntp-4.2.6p5-28.el7.centos.x86_64.rpm | 549 kB 00:00:01
-------------------------------------------------------------------------------------------
Total 572 kB/s | 701 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : autogen-libopts-5.18-5.el7.x86_64 1/4
Updating : ntpdate-4.2.6p5-28.el7.centos.x86_64 2/4
Installing : ntp-4.2.6p5-28.el7.centos.x86_64 3/4
Cleanup : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 4/4
Verifying : ntpdate-4.2.6p5-28.el7.centos.x86_64 1/4
Verifying : autogen-libopts-5.18-5.el7.x86_64 2/4
Verifying : ntp-4.2.6p5-28.el7.centos.x86_64 3/4
Verifying : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 4/4
Installed:
ntp.x86_64 0:4.2.6p5-28.el7.centos
Dependency Installed:
autogen-libopts.x86_64 0:5.18-5.el7
Updated:
ntpdate.x86_64 0:4.2.6p5-28.el7.centos
Complete!
[root@root ~]#
[root@root ~]# ntpdate cn.pool.ntp.org
22 Jul 03:36:04 ntpdate[1939]: step time server 120.25.115.20 offset 5.753930 sec
[root@root ~]# date
Mon Jul 22 03:36:21 CEST 2019
[root@root ~]# date
Mon Jul 22 03:37:02 CEST 2019
[root@root ~]# hwclock --systohc
[root@root ~]# systemctl stop firewalld
[root@root ~]# systemctl disable firewalld
[root@root ~]# ^C
[root@root ~]# date
Mon Jul 22 03:38:09 CEST 2019
[root@root ~]#
[root@root ~]# date
Mon Jul 22 03:38:16 CEST 2019
[root@root ~]# vim /etc/my.cnf
[root@root ~]# systemctl stop mysql
[root@root ~]# systemctl start mysql
[root@root ~]# mysql -uroot -pABC123.com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create user 'copy'@'%' identified with mysql_native_password by 'Cloudbu@123';
Query OK, 0 rows affected (0.02 sec)
mysql> grant replication slave on *.* to 'copy'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 825 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.12 sec)
mysql> drop database test;
Query OK, 0 rows affected (0.06 sec)
mysql> cteate database test;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'cteate database test' at line 1
mysql> create database test;
Query OK, 1 row affected (0.02 sec)
mysql> show slave status\G
Empty set (0.00 sec)
mysql> ^C
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> create database a;
Query OK, 1 row affected (0.01 sec)
mysql>
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.05 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| a |
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
6 rows in set (0.01 sec)
mysql> use a
Database changed
mysql> create table user_test(id int);
ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock
mysql> \q
Bye
[root@root ~]# mysqldump -uroot -pABC123.com --routines --events --triggers --master-data=2 --flush-logs --all-databases > ./all_'date +%F'.sql 192.168.59.134:/root
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[root@root ~]# mysqldump -uroot -pABC123@com --routines --events --triggers --master-data=2 --flush-logs --all-databases > ./all_'date +%F'.sql 192.168.59.134:/root
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[root@root ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create user 'copy'@'%' identified with mysql_native_password by 'ABC123@com';
ERROR 1396 (HY000): Operation CREATE USER failed for 'copy'@'%'
mysql> unlock stables;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'stables' at line 1
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
mysql> create user 'copy'@'%' identified with mysql_native_password by 'ABC123@com';
ERROR 1396 (HY000): Operation CREATE USER failed for 'copy'@'%'
mysql>
───────────────────────────────────────────────────────────────────────────────────────────
Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file
Network error: Software caused connection abort
login as: root
┌────────────────────────────────────────────────────────────────────┐
│ • MobaXterm 10.2 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to root@192.168.59.129 │
│ • SSH compression : ✔ │
│ • SSH-browser : ✔ │
│ • X11-forwarding : ✘ (disabled or not supported by server) │
│ • DISPLAY : 192.168.254.25:0.0 │
│ │
│ ➤ For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Sun Jul 21 03:18:17 2019 from 192.168.59.1
[root@root ~]#
[root@root ~]# yum -y install ntp ntpdate
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-28.el7.centos will be installed
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-28.el7.centos.x86_64
---> Package ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2 will be updated
---> Package ntpdate.x86_64 0:4.2.6p5-28.el7.centos will be an update
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================
Installing:
ntp x86_64 4.2.6p5-28.el7.centos base 549 k
Updating:
ntpdate x86_64 4.2.6p5-28.el7.centos base 86 k
Installing for dependencies:
autogen-libopts x86_64 5.18-5.el7 base 66 k
Transaction Summary
=====================================================================================================================================================================
Install 1 Package (+1 Dependent package)
Upgrade 1 Package
Total download size: 701 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/3): ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm | 86 kB 00:00:00
(2/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00
(3/3): ntp-4.2.6p5-28.el7.centos.x86_64.rpm | 549 kB 00:00:01
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 439 kB/s | 701 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : autogen-libopts-5.18-5.el7.x86_64 1/4
Updating : ntpdate-4.2.6p5-28.el7.centos.x86_64 2/4
Installing : ntp-4.2.6p5-28.el7.centos.x86_64 3/4
Cleanup : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 4/4
Verifying : ntpdate-4.2.6p5-28.el7.centos.x86_64 1/4
Verifying : autogen-libopts-5.18-5.el7.x86_64 2/4
Verifying : ntp-4.2.6p5-28.el7.centos.x86_64 3/4
Verifying : ntpdate-4.2.6p5-25.el7.centos.2.x86_64 4/4
Installed:
ntp.x86_64 0:4.2.6p5-28.el7.centos
Dependency Installed:
autogen-libopts.x86_64 0:5.18-5.el7
Updated:
ntpdate.x86_64 0:4.2.6p5-28.el7.centos
Complete!
[root@root ~]# ntpdate cn.pool.ntp.org
22 Jul 05:05:52 ntpdate[2728]: step time server 193.228.143.14 offset 1.822897 sec
[root@root ~]# hwclock --systohc
[root@root ~]# date -F
date: invalid option -- 'F'
Try 'date --help' for more information.
[root@root ~]# date --help
Usage: date [OPTION]... [+FORMAT]
or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.
Mandatory arguments to long options are mandatory for short options too.
-d, --date=STRING display time described by STRING, not 'now'
-f, --file=DATEFILE like --date once for each line of DATEFILE
-I[TIMESPEC], --iso-8601[=TIMESPEC] output date/time in ISO 8601 format.
TIMESPEC='date' for date only (the default),
'hours', 'minutes', 'seconds', or 'ns' for date
and time to the indicated precision.
-r, --reference=FILE display the last modification time of FILE
-R, --rfc-2822 output date and time in RFC 2822 format.
Example: Mon, 07 Aug 2006 12:34:56 -0600
--rfc-3339=TIMESPEC output date and time in RFC 3339 format.
TIMESPEC='date', 'seconds', or 'ns' for
date and time to the indicated precision.
Date and time components are separated by
a single space: 2006-08-07 12:34:56-06:00
-s, --set=STRING set time described by STRING
-u, --utc, --universal print or set Coordinated Universal Time (UTC)
--help display this help and exit
--version output version information and exit
FORMAT controls the output. Interpreted sequences are:
%% a literal %
%a locale's abbreviated weekday name (e.g., Sun)
%A locale's full weekday name (e.g., Sunday)
%b locale's abbreviated month name (e.g., Jan)
%B locale's full month name (e.g., January)
%c locale's date and time (e.g., Thu Mar 3 23:05:25 2005)
%C century; like %Y, except omit last two digits (e.g., 20)
%d day of month (e.g., 01)
%D date; same as %m/%d/%y
%e day of month, space padded; same as %_d
%F full date; same as %Y-%m-%d
%g last two digits of year of ISO week number (see %G)
%G year of ISO week number (see %V); normally useful only with %V
%h same as %b
%H hour (00..23)
%I hour (01..12)
%j day of year (001..366)
%k hour, space padded ( 0..23); same as %_H
%l hour, space padded ( 1..12); same as %_I
%m month (01..12)
%M minute (00..59)
%n a newline
%N nanoseconds (000000000..999999999)
%p locale's equivalent of either AM or PM; blank if not known
%P like %p, but lower case
%r locale's 12-hour clock time (e.g., 11:11:04 PM)
%R 24-hour hour and minute; same as %H:%M
%s seconds since 1970-01-01 00:00:00 UTC
%S second (00..60)
%t a tab
%T time; same as %H:%M:%S
%u day of week (1..7); 1 is Monday
%U week number of year, with Sunday as first day of week (00..53)
%V ISO week number, with Monday as first day of week (01..53)
%w day of week (0..6); 0 is Sunday
%W week number of year, with Monday as first day of week (00..53)
%x locale's date representation (e.g., 12/31/99)
%X locale's time representation (e.g., 23:13:48)
%y last two digits of year (00..99)
%Y year
%z +hhmm numeric time zone (e.g., -0400)
%:z +hh:mm numeric time zone (e.g., -04:00)
%::z +hh:mm:ss numeric time zone (e.g., -04:00:00)
%:::z numeric time zone with : to necessary precision (e.g., -04, +05:30)
%Z alphabetic time zone abbreviation (e.g., EDT)
By default, date pads numeric fields with zeroes.
The following optional flags may follow '%':
- (hyphen) do not pad the field
_ (underscore) pad with spaces
0 (zero) pad with zeros
^ use upper case if possible
# use opposite case if possible
After any flags comes an optional field width, as a decimal number;
then an optional modifier, which is either
E to use the locale's alternate representations if available, or
O to use the locale's alternate numeric symbols if available.
Examples:
Convert seconds since the epoch (1970-01-01 UTC) to a date
$ date --date='@2147483647'
Show the time on the west coast of the US (use tzselect(1) to find TZ)
$ TZ='America/Los_Angeles' date
Show the local time for 9AM next Friday on the west coast of the US
$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'date invocation'
[root@root ~]#
[root@root ~]# date
Mon Jul 22 05:07:05 CEST 2019
[root@root ~]# systemctl stop firewalld
[root@root ~]# systemctl disable firewalld
[root@root ~]# vim /etc/my.cnf
[root@root ~]# systemctl stop mysql
[root@root ~]# systemctl start mysql
[root@root ~]# mysql -uroot -pABC123.com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> reset master;
Query OK, 0 rows affected (0.02 sec)
mysql> create user 'copy'@'%' identified with mysql_native_password by 'Cloudbu@123';
Query OK, 0 rows affected (0.02 sec)
mysql> grant replication slave on *.* to 'copy'@'%';
Query OK, 0 rows affected (0.08 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 825 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
mysql> CHANGE MASTER TO
-> MASTER_HOST='192.168.59.134',
-> MASTER_USER='copy',
-> MASTER_PASSWORD='Cloudbu@123',
-> MASTER_LOG_FILE='mysql-bin.000001',
-> MASTER_LOG_POS=825;
Query OK, 0 rows affected, 2 warnings (0.10 sec)
mysql> start slave;
Query OK, 0 rows affected (0.02 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.59.134
Master_User: copy
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 825
Relay_Log_File: root-relay-bin.000002
Relay_Log_Pos: 322
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 825
Relay_Log_Space: 529
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 66
Master_UUID: 282ee0ed-ab3a-11e9-a73d-000c29c9a9c0
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
1 row in set (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.14 sec)
mysql> create database a;
Query OK, 1 row affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| a |
| b |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql>\q
192.168.59.134 试验过程 rpm安装mysql
login as: root
┌────────────────────────────────────────────────────────────────────┐
│ • MobaXterm 10.2 • │
│ (SSH client, X-server and networking tools) │
│ │
│ ➤ SSH session to root@192.168.59.134 │
│ • SSH compression : ✔ │
│ • SSH-browser : ✔ │
│ • X11-forwarding : ✘ (disabled or not supported by server) │
│ • DISPLAY : 192.168.254.25:0.0 │
│ │
│ ➤ For more info, ctrl+click on help or visit our website │
└────────────────────────────────────────────────────────────────────┘
Last login: Sun Jul 21 05:27:20 2019 from 192.168.59.1
[root@localhost ~]#
[root@localhost ~]# yum -y install ntp ntpdate
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirror.lzu.edu.cn
* updates: mirror.lzu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-28.el7.centos will be installed
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-28.el7.centos.x86_64
---> Package ntpdate.x86_64 0:4.2.6p5-28.el7.centos will be installed
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================
Installing:
ntp x86_64 4.2.6p5-28.el7.centos base 549 k
ntpdate x86_64 4.2.6p5-28.el7.centos base 86 k
Installing for dependencies:
autogen-libopts x86_64 5.18-5.el7 base 66 k
Transaction Summary
=====================================================================================================================================================================
Install 2 Packages (+1 Dependent package)
Total download size: 701 k
Installed size: 1.6 M
Downloading packages:
(1/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00
(2/3): ntpdate-4.2.6p5-28.el7.centos.x86_64.rpm | 86 kB 00:00:00
(3/3): ntp-4.2.6p5-28.el7.centos.x86_64.rpm | 549 kB 00:00:01
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 464 kB/s | 701 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : autogen-libopts-5.18-5.el7.x86_64 1/3
Installing : ntpdate-4.2.6p5-28.el7.centos.x86_64 2/3
Installing : ntp-4.2.6p5-28.el7.centos.x86_64 3/3
Verifying : ntpdate-4.2.6p5-28.el7.centos.x86_64 1/3
Verifying : autogen-libopts-5.18-5.el7.x86_64 2/3
Verifying : ntp-4.2.6p5-28.el7.centos.x86_64 3/3
Installed:
ntp.x86_64 0:4.2.6p5-28.el7.centos ntpdate.x86_64 0:4.2.6p5-28.el7.centos
Dependency Installed:
autogen-libopts.x86_64 0:5.18-5.el7
Complete!
[root@localhost ~]# ntpdate cn.pool.ntp.org
22 Jul 11:05:56 ntpdate[9253]: step time server 193.228.143.14 offset 1.680012 sec
[root@localhost ~]# hwclock --systohc
[root@localhost ~]# date
Mon Jul 22 11:07:09 CST 2019
[root@localhost ~]#
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# yum install vim -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* extras: mirror.lzu.edu.cn
* updates: mirror.lzu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.160-6.el7_6 will be installed
--> Processing Dependency: vim-common = 2:7.4.160-6.el7_6 for package: 2:vim-enhanced-7.4.160-6.el7_6.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.160-6.el7_6.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-5.el7 will be installed
---> Package vim-common.x86_64 2:7.4.160-6.el7_6 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.160-6.el7_6.x86_64
--> Running transaction check
---> Package vim-filesystem.x86_64 2:7.4.160-6.el7_6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.160-6.el7_6 updates 1.0 M
Installing for dependencies:
gpm-libs x86_64 1.20.7-5.el7 base 32 k
vim-common x86_64 2:7.4.160-6.el7_6 updates 5.9 M
vim-filesystem x86_64 2:7.4.160-6.el7_6 updates 10 k
Transaction Summary
=====================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 7.0 M
Installed size: 23 M
Downloading packages:
(1/4): gpm-libs-1.20.7-5.el7.x86_64.rpm | 32 kB 00:00:00
(2/4): vim-enhanced-7.4.160-6.el7_6.x86_64.rpm | 1.0 MB 00:00:02
(3/4): vim-filesystem-7.4.160-6.el7_6.x86_64.rpm | 10 kB 00:00:00
(4/4): vim-common-7.4.160-6.el7_6.x86_64.rpm | 5.9 MB 00:00:04
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 7.0 MB 00:00:04
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gpm-libs-1.20.7-5.el7.x86_64 1/4
Installing : 2:vim-filesystem-7.4.160-6.el7_6.x86_64 2/4
Installing : 2:vim-common-7.4.160-6.el7_6.x86_64 3/4
Installing : 2:vim-enhanced-7.4.160-6.el7_6.x86_64 4/4
Verifying : 2:vim-enhanced-7.4.160-6.el7_6.x86_64 1/4
Verifying : 2:vim-filesystem-7.4.160-6.el7_6.x86_64 2/4
Verifying : gpm-libs-1.20.7-5.el7.x86_64 3/4
Verifying : 2:vim-common-7.4.160-6.el7_6.x86_64 4/4
Installed:
vim-enhanced.x86_64 2:7.4.160-6.el7_6
Dependency Installed:
gpm-libs.x86_64 0:1.20.7-5.el7 vim-common.x86_64 2:7.4.160-6.el7_6 vim-filesystem.x86_64 2:7.4.160-6.el7_6
Complete!
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# systemctl stop mysql
Failed to stop mysql.service: Unit mysql.service not loaded.
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -uroot -pABC123@com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> \q
Bye
[root@localhost ~]# vim /etc/my.cnf
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -uroot -pABC123@com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> reset master;
Query OK, 0 rows affected (0.02 sec)
mysql> create user 'copy'@'%' identified with mysql_native_password by 'Cloudbu@123';
Query OK, 0 rows affected (0.02 sec)
mysql> grant replication slave on *.* to 'copy'@'%';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 825 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
mysql> CHANGE MASTER TO
-> MASTER_HOST='192.168.59.129',
-> MASTER_USER='copy',
-> MASTER_PASSWORD='Cloudbu@123',
-> MASTER_LOG_FILE='mysql-bin.000001',
-> MASTER_LOG_POS=825;
Query OK, 0 rows affected, 2 warnings (0.04 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.59.129
Master_User: copy
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 825
Relay_Log_File: localhost-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 825
Relay_Log_Space: 155
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.02 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 192.168.59.129
Master_User: copy
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 825
Relay_Log_File: localhost-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 825
Relay_Log_Space: 155
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set (0.00 sec)
mysql> \q
Bye
[root@localhost ~]# cat /var/lib/mysql/auto.cnf
[auto]
server-uuid=282ee0ed-ab3a-11e9-a73d-000c29c9a9c0
[root@localhost ~]# systemctl stop mysqld
[root@localhost ~]# cat /var/lib/mysql/auto.cnf
[auto]
server-uuid=282ee0ed-ab3a-11e9-a73d-000c29c9a9c0
[root@localhost ~]# rm /var/lib/mysql/auto.cnf
rm: remove regular file ‘/var/lib/mysql/auto.cnf’? yes
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# cat /var/lib/mysql/auto.cnf
[auto]
server-uuid=35be7718-ac2f-11e9-ab7b-000c29c9a9c0
[root@localhost ~]# mysql -uroot -pABC123@com
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.59.129
Master_User: copy
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 825
Relay_Log_File: localhost-relay-bin.000004
Relay_Log_Pos: 322
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 825
Relay_Log_Space: 534
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 10
Master_UUID: f859c73f-ab5a-11e9-988f-000c29008cb0
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.59.129
Master_User: copy
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 825
Relay_Log_File: localhost-relay-bin.000004
Relay_Log_Pos: 322
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 825
Relay_Log_Space: 534
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 10
Master_UUID: f859c73f-ab5a-11e9-988f-000c29008cb0
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
Network_Namespace:
1 row in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| a |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> create database b;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| a |
| b |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
6 rows in set (0.00 sec)
mysql>\q