curl -L -O https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.23-el7-x86_64.tar
[root]# rpm -qa|grep mysql[root]# rpm -qa |grep mariadb-libs
yum hapus mariadb-libs -y
tar -xvf mysql-8.0.23-el7-x86_64.tar
[root]# groupadd mysql[root]# useradd -r -g mysql -s /bin/false mysql [root]# cd /usr/local/
[root local]# tar xzvf /root/mysql-8.0.23-el7-x86_64.tar.gz
sudo ln -s /usr/local/mysql-8.0.23-el7-x86_64/ mysql
mkdir -p /mysql/{3306,3307,3308,3309}/data
chown -R mysql:mysql /mysql
cd /mysql
Contoh 1 (3306)
[mysqld]port =3306basedir=/usr/local/mysql/
datadir=/mysql/3306/data
lower_case_table_names=1
innodb_buffer_pool_size=128M
socket =/tmp/mysql_3306.sock
log_error=/mysql/3306/data/mysql06.log
Contoh 2 (3307)
[mysqld]port =3307basedir=/usr/local/mysql/
datadir=/mysql/3307/data
lower_case_table_names=1
innodb_buffer_pool_size=128M
socket =/tmp/mysql_3307.sock
log_error=/mysql/3307/data/mysql07.log
Contoh 3 (3308)
[mysqld]port =3308basedir=/usr/local/mysql/
datadir=/mysql/3308/data
lower_case_table_names=1
innodb_buffer_pool_size=128M
socket =/tmp/mysql_3308.sock
log_error=/mysql/3308/data/mysql08.log
3306
/usr/local/mysql/bin/mysqld –defaults-file=/mysql/3306/my.cnf –initialize –basedir=/usr/local/mysql/ –datadir=/mysql/3306/data
3307
/usr/local/mysql/bin/mysqld –defaults-file=/mysql/3307/my.cnf –initialize –basedir=/usr/local/mysql/ –datadir=/mysql/3307/data
3308
/usr/local/mysql/bin/mysqld –defaults-file=/mysql/3308/my.cnf –initialize –basedir=/usr/local/mysql/ –datadir=/mysql/3308/data
ln -s /usr/local/mysql/bin/mysqld /usr/bin
[root]# vi /etc/profileatau vi .bash_profile
# Tambahkan informasi berikut di akhir file
ekspor PATH=$PATH:/usr/local/mysql/bin
#Membuat variabel lingkungan berlaku
[root]# source /etc/profile
# Setelah pengujian, beberapa izin file yang baru dibuat oleh mysql selama inisialisasi adalah root, jadi yang terbaik adalah mengotorisasi ulang jalur datadir ke mysql sebelum memulai
chown -R mysql:mysql /mysql
nohup /usr/local/mysql/bin/mysqld –defaults-file=/mysql/3306/my.cnf –user=mysql &
nohup /usr/local/mysql/bin/mysqld –defaults-file=/ mysql/3307/my.cnf –user=mysql &
nohup /usr/local/mysql/bin/mysqld –defaults-file=/mysql/3308/my.cnf –user=mysql &
ps -ef| grep mysql
netstat -ntl
#Ubah kata sandi untuk semua instance satu per satu:
mysql -S /tmp/mysql_3306.sock -p
#masukkan kata sandi sementara dari log:
ubah pengguna 'root'@'localhost' yang diidentifikasi oleh 'Not_so_secure1!';
untuk mematikan instance
[[email protected] bin]# pwd
/usr/local/mysql/bin
[[email protected] bin]# ./mysqladmin -h127.0.0 .1 -uroot -p -P3306 shutdown
Masukkan kata sandi:
[email protected] bin]# ps -ef| grep mysql
mysql 22218 21246 0 11:56 pts/1 00:00:03 /usr/local/mysql/bin/mysqld –defaults-file=/mysql/3307/my.cnf –user=mysql
mysql 22259 21246 0 11:56 pts/1 00:00:03 /usr/local/mysql/bin/mysqld –defaults-file=/mysql/3308/my.cnf –user=mysql
root 22673 21537 0 12:24 pts/2 00:00:00 mysql -S /tmp/mysql_3306.sock -p
root 22705 21537 0 12:26 pts/2 00:00:00 grep –color=auto mysql