mysql_basic_os_related

MySQL-related OS Command

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
gunzip -c a.tar.gz | tar -xvf -
gunzip < a.tar.gz | tar -xvf -
zcat a.tar.gz | tar -xvf -
tar -zxvf a.tar.gz


# md5 check
md5sum package_name;
openssl md5 package_name;
gpg --import mysql_pubky.asc
gpg --recv-keys 5072E1F5
gpg --verify package_name.asc
rpm --import mysql_pubkey.asc

yum install mysql-community-{server,client,common,libs}-*
yum-config-manager --disable mariadb
yum --disablerepo=\* --enablerepo='mysql*-community*' list available
yum --disablerepo=epel list installed mysql\*
yumdownloader --disablerepo=epel yum-utils
yum-config-manager --disable mariadb
rpm -qpl package_name.rpm
dpkg-preconfigure mysql-community-server_*.deb
dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
apt-get -f install


cat /etc/my.cnf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@master ~]# cat /etc/my.cnf
[mysqld@01]
port=3306
datadir=/var/lib/mysqld01
socket=/var/lib/mysqld01/mysqld01.sock
symbolic-links=0
log-error=/var/log/mysqld01.log
pid-file=/var/run/mysqld01/mysqld01.pid

[mysqld@02]
port=3307
datadir=/var/lib/mysqld02
socket=/var/lib/mysqld02/mysqld02.sock
symbolic-links=0
log-error=/var/log/mysqld02.log
pid-file=/var/run/mysqld02/mysqld02.pid

[mysqld@03]
port=3308
datadir=/var/lib/mysqld03
socket=/var/lib/mysqld03/mysqld03.sock
symbolic-links=0
log-error=/var/log/mysqld03.log
pid-file=/var/run/mysqld03/mysqld03.pid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

systemctl daemon-reload
systemctl start mysqld@01
systemctl start mysqld@02
systemctl start mysqld@03

[root@master ~]# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 52 192.168.1.4:22 192.168.1.1:13648 ESTABLISHED
tcp6 0 0 :::3306 :::* LISTEN
tcp6 0 0 :::3307 :::* LISTEN
tcp6 0 0 :::3308 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
[root@master ~]#