1. Dowload the community version bundle
https://dev.mysql.com/downloads/mysql/
Red Hat Enterprise Linux 8 / Oracle Linux 8 (x86, 64-bit), RPM Bundle
(mysql-8.0.32-1.el8.x86_64.rpm-bundle.tar)
2. Copy in some folder like /repo/mysql/mysql-8.0.32-1.el8.x86_64.rpm-bundle.tar
mkdir -p /repo/mysql
cd /repo/mysql/
3. tar -xvf mysql-8.0.32-1.el8.x86_64.rpm-bundle.tar
Must be in the directory /repo/mysql/ before running below command
yum install mysql-community-{server,client,client-plugins,icu-data-files,common,libs,debuginfo}-*
4. Create directories to hold database files
mkdir -p /u01/data
mkdir -p /u01/log_bin
mkdir -p /u01/tmpdir
chown -R mysql:mysql /u01
chmod -R 755 /u01
Edit /etc/my.cnf file and add below parameters(comment existing datadir)
user=mysql
log_bin=/u01/log_bin/myDB
datadir=/u01/data
tmpdir=/u01/tmpdir
5. Enable MySQL services to autostart on reboot
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld
6. grep 'temporary password' /var/log/mysqld.log
loging by below
mysql -uroot -p
on prompt enter the temp password
Once login in the mysql change the temp password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Oracle_123';
show databases command to see the dbs.
os = mysql/Ora_123
7. Secure MySQL 8 Installation
Check the temporary password for MySQL
grep 'temporary password' /var/log/mysqld.log
Secure MySQL
/usr/bin/mysql_secure_installation
If something goes wrong during installation, you might find debug information in the error log file /var/log/mysqld.log.
SHOW GLOBAL VARIABLES LIKE 'PORT';
[root@host ~]# netstat -tlnp | grep 3306
tcp6 0 0 :::33060 :::* LISTEN 154219/mysqld
tcp6 0 0 :::3306 :::* LISTEN 154219/mysqld
lsof -n | grep 'mysql.*TCP'
Edit /etc/my.cnf file and add below parameters for remote access
bind-address = 0.0.0.0
If you want to allow a specific client ip-address (for example: 192.168.1.4) to access the mysql database running on a server, you should execute the following command on the server that is running the mysql database.
$ mysql -u root -p
Enter password:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Oracle_123';
mysql use mysql
mysql GRANT ALL ON . to root@'192.168.1.4' IDENTIFIED BY 'xxx';
mysql FLUSH PRIVILEGES;
CREATE USER 'kashif'@'localhost' IDENTIFIED BY 'Oracle_123';
GRANT ALL PRIVILEGES ON . TO 'kashif'@'localhost' WITH GRANT OPTION;
CREATE USER 'kashif'@'%' IDENTIFIED BY 'Oracle_123';
GRANT ALL PRIVILEGES ON . TO 'kashif'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Oracle_123
alter USER 'root'@'%' IDENTIFIED BY 'Oracle_123';