You can download the MySQL binary files from below link.
https://downloads.mysql.com/archives/get/file/mysql-5.7.21-el7-x86_64.tar.gz
1:- Add OS group
1 | groupadd mysql |
2:- Add OS user
1 | useradd -r -g mysql -s /bin/false mysql |
3:- Go to MySQL installation path
1 | cd /usr/local |
4:- Extract the tar.gz file
1 | tar zxvf /usr/local/mysql-5.7.21-el7-x86_64.tar.gz |
5:- Create a soft link with mysql with installation packages
1 | ln -s /usr/local/mysql-5.7.21-el7-x86_64/ mysql |
6:-Go to mysql directory
1 | cd mysql |
7:- Create mysql-files directory
1 | mkdir mysql-files |
8:- Change the owner ship of mysql-files
1 | chown mysql:mysql mysql-files |
9:- Change permission of mysql-files
1 | chmod 750 mysql-files |
10:- Create mysql data directory
1 | mkdir /var/lib/mysql/ |
11:- Change the ownership and assign privileges to them.
1 2 | chown –R mysql:mysql /var/lib/mysql chmod 755 /var/lib/mysql/ |
12:- Initialize the service
1 | mysql-5.7.21-el7-x86_64/bin/mysqld --initialize --user=mysql --lc-messages-dir="/usr/local/mysql/mysql-5.7.21-el7-x86_64/share/english/" --datadir=/var/lib/mysql/ |
Note:- –lc-messages-dir=”/usr/local/mysql/mysql-5.7.21-el7-x86_64/share/english/
” Used this option because getting error of missing errormsg.sys file.
13:- Create the ssl key for security resons in mysql 5.7
1 | mysql-5.7.21-el7-x86_64/bin/mysql_ssl_rsa_setup –datadir=/var/lib/mysql/ |
14:- Start the service with below command
1 | mysql-5.7.21-el7-x86_64/bin/mysqld_safe --user=mysql --datadir=/var/lib/mysql/ & |
15:- Take a login and change the password with below command
1 | mysql-5.7.21-el7-x86_64/bin/mysql -u root –p |
16:- Set environment variables for easy use
- in .bashrc file enter the below path
1 | export PATH=${PATH}:/usr/local/mysql/mysql-5.7.21-el7-x86_64/bin |
- in .bash_profile file enter the same path there
1 | export PATH=${PATH}:/usr/local/mysql/mysql-5.7.21-el7-x86_64/bin |
17:- set the bash profile globaly
1 | . .bashrc |
great !!
Thanks Ajay.