Posts

Showing posts from April, 2020

HOW TO SETUP GTID MASTER SLAVE REPLICATION MYSQL 5.7

A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master). This identifier is unique not only to the server on which it originated, but is unique across all servers in a given replication setup. There is a 1-to-1 mapping between all transactions and all GTIDs. A GTID is represented as a pair of coordinates, separated by a colon character (:), as shown here: GTID = source_id:transaction_idMySQL_gtid-master-slave Advantages : ● Setting up MySQL replication is simple ● Consistency is guaranteed between master and slaves. ● Simple to determine inconsistency ● Fail-over process become much easier. step.1. stop the both master and slave servers. systemctl stop mysqld step.2. configure the master server. To enable GTID-based replication, each server must be started with GTID mode enabled by setting the gtid_mode variable to ON, and with the enforce_gtid_consistency variable enabled to ...

Recover MySQL 5.7 root Password in Redhat/CentOS 7

step.1. stop mysqld service systemctl stop mysqld  step.2.set the mysql enviroment option systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" step.3 start mysqld service using the option just you set systemctl start mysqld step .4. login as root mysql -u root  step.5.update the root user password using this command mysql> UPDATE mysql.user SET authentication_string = PASSWORD('YourNewPassword') -> WHERE User = 'root' AND Host = 'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit step.6.stop mysqld systemctl stop mysqld step.7. unset the mysql enviroment variable  systemctl unset-environment MYSQLD_OPTS step.8.start mysqld service normally systemctl start mysqld step.9. mysql -u root -p