[HOW TO] get the server ID in MySQL

Sometimes, you have to know the Server ID of MySQL, and you don't know how to get it?

Here I show you.

What is Server ID? 
Server always use in MySQL Replication. It defines in numeric to classify the server.

As always, server ID 1 is master server. Then server ID n+1 is slave server.

How to find it?
You use below MySQL command
# Get MySQL server_id
mysql> SHOW VARIABLES LIKE 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 1     |
+---------------+-------+
1 row in set (0.01 sec)

# Change MySQL server_id
mysql>  SET GLOBAL server_id=21


Tiến Phan - R0039

Knowledge is Endless

Sharing for Success

0 nhận xét:

Post a Comment