Testing the Cluster
To perform a test on our new MySQL Cluster, we have to login to the SQL Nodes db4 or db5 servers.
Login to the db4 server:
ssh root@192.168.1.123
Change the default MySQL password that stored in “.mysql_secret” file in root directory:
cd ~
cat .mysql_secret
this is my sample:
# The random password set for the root user at Tue Mar 22 19:44:07 2016 (local time): qna3AwbJMuOnw23T
Now change the password with command below:
mysql_secure_installation
Type your old mysql password and then type the new one, press enter to confirm all.
If all is done, you can login to the MySQL shell with your password:
mysql -u root -p
After you logged in, create a new root user with host “@“, so we will be able to access the MySQL from outside.
CREATE USER ‘root’@’%’ IDENTIFIED BY ‘aqwe123’;
Replace aqwe123 with your own secure password! Now you can see the new root user with host “@” on the MySQL user list:
select user, host, password from mysql.user;
And grant the new root user read and write access from the remote node:
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY PASSWORD ‘*94CC7BF027327993D738E11…(Encrypted PASSWORD)’ WITH GRANT OPTION;
Now try to create a new database from db4 server and you will see the database on db5 too.
This is just a sample result for testing the cluster data replication.
The MySQL Cluster has been setup successfully on CentOS 7 with 5 server nodes.