Step 1 . Oracle provides a set of binary distributions of MySQL. These include generic binary distributions in the form of compressed tar files (files with a .tar.gz extension) for a number of platform .
- Download it from mysql site.
- https://downloads.mysql.com/archives/
- Select your version and platform and download the .tar type
- Ex. Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), TAR
- Downloaded file mysql-5.7.28-el7-x86_64.tar.gz
Step 2. Remove previous versions of installed binary
Checking installed --------- rpm -qa | egrep mysql
Uninstall existing ones --------- rpm -e mysql.XXXXXXXX
Step 3: Unzip files where you wanted to keep the mysql binary (Base Directory)
Here i did it on /u01/mysql path and the directory Structure.
[root@xcell oradba]# tar -xzvf mysql-5.7.28-el7-x86_64.tar.gz -C /u01/mysql
[root@xcell mysql-5.7.28-el7-x86_64]# ls -lrt
total 312
-rw-r--r--. 1 7161 31415 587 Sep 27 2019 README
-rw-r--r--. 1 7161 31415 279547 Sep 27 2019 LICENSE
drwxr-xr-x. 3 root root 4096 Apr 24 22:46 include
drwxr-xr-x. 4 root root 4096 Apr 24 22:46 man
drwxr-xr-x. 2 root root 4096 Apr 24 22:47 bin -
drwxr-xr-x. 2 root root 4096 Apr 24 22:47 support-files
drwxr-xr-x. 28 root root 4096 Apr 24 22:47 share
drwxr-xr-x. 5 root root 4096 Apr 24 22:47 lib
drwxr-xr-x. 2 root root 4096 Apr 24 22:47 docs
| Directory | Contents of Directory |
|---|---|
bin | mysqd server, client and utility programs |
docs | MySQL manual in Info format |
man | Unix manual pages |
include | Include (header) files |
lib | Libraries |
share | Error messages, dictionary, and SQL for database installation |
support-files | Miscellaneous support files |
Step 4: Add necessary users
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
chown mysql:mysql /u01/mysql
Step 5: Go to the binary location and support-files directory ,
create the config file or Option file
EX. My.cnf
total 28
-rw-r--r--. 1 mysql mysql 773 Sep 27 2019 magic
-rwxr-xr-x. 1 mysql mysql 10576 Sep 27 2019 mysql.server
-rwxr-xr-x. 1 mysql mysql 894 Sep 27 2019 mysql-log-rotate
-rwxr-xr-x. 1 mysql mysql 1061 Sep 27 2019 mysqld_multi.server
-rw-r--r--. 1 mysql mysql 177 Apr 24 23:00 my.cnf
Also create a soft link in below location
[root@xcell ~]# ls -lrt /etc/my.cnf
lrwxrwxrwx. 1 root root 55 Apr 25 16:31 /etc/my.cnf -> /u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf
[root@xcell ~]#
[root@xcell ~]# cat /etc/my.cnf
[mysqld]
server-id=2 -- Serverid (for multiple serv)
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql.sock -- socket file
port=3307 -- port (default 3306)
basedir=/u01/mysql/mysql-5.7.28-el7-x86_64
general-log
datadir=/u01/mysql/mysql-5.7.28-el7-x86_64/data --- location for new database
max_binlog_size=4096
log-bin=mysql
[client] -- Client Option used for client conn as root or os auth
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql.sock
[root@xcell ~]#
Step 6: Go back to Bin location inside binary
[root@xcell bin]# ./mysqld --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf --user=mysql --initialize 2020-04-24T18:05:03.535086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-04-24T18:05:04.298446Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-04-24T18:05:04.627597Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-04-24T18:05:04.701383Z 0 [Warning] No existing UUID has been found,
so we assume that this is the first time that this server has been started.
Generating a new UUID: 1fcc4cde-8656-11ea-8b82-08002743c30b.
2020-04-24T18:05:05.042753Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-04-24T18:05:09.874302Z 0 [Warning] CA certificate ca.pem is self signed.
2020-04-24T18:05:10.591258Z 1 [Note] A temporary password is generated for root@localhost: r5g:+l9&jecG
[root@xcell bin]#
root@devserver support-files]# ls
magic my.cnf mysqld_multi.server mysql-log-rotate mysql.server
[root@devserver support-files]# ls -lrt
total 28
-rw-r--r--. 1 mysql mysql 773 Sep 27 2019 magic
-rwxr-xr-x. 1 mysql mysql 10576 Sep 27 2019 mysql.server
-rwxr-xr-x. 1 mysql mysql 894 Sep 27 2019 mysql-log-rotate
-rwxr-xr-x. 1 mysql mysql 1061 Sep 27 2019 mysqld_multi.server
-rw-r--r--. 1 mysql mysql 341 May 10 14:33 my.cnf
[root@devserver support-files]# ./mysql.server start
Step 7: Secure your installation using the above auto generated root pass
and change the user pass
mysql_secure_installation --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf
mysql_secure_installation --defaults-file=/u01/mysql/mysql-5.7.28-el7-x86_64/support-files/my.cnf
socket=/u01/mysql/mysql-5.7.28-el7-x86_64/mysql2.sock
Securing the MySQL server deployment.
Enter password for user root:
Step 8: Configure the mysqld as a linux service.
[root@xcell system]# service mysqld statusRedirecting to /bin/systemctl status mysqld.service
[root@xcell system]#
Securing the MySQL server deployment.
Enter password for user root:
Step 8: Configure the mysqld as a linux service.