In this post we will see how to install Mysql Database 5.7.35 in Linux Operating System.

For more interesting posts on MySQL, please click on INDEX

Steps :

1. Create the below directories :

mkdir -p /mysqldatabase/TEST/admin/
mkdir -p /mysqldatabase/TEST/logs/
mkdir -p /mysqldatabase/TEST/tmp
mkdir -p /mysqldatabase/TEST/data
mkdir -p /mysqldatabase/TEST/binlogs
mkdir -p /mysqldatabase/product/binary

 

2. Traverse to the location where you want to install the MySQL Binaries

cd /mysqldatabase/product/binary

 

3. Get the Link to download the binaries

Go to google and search for MySQL 5.x download.

Select the operating system and OS Version to download the edsired version. If the desired version isn’t available, then click on Archives and check for the latest version.

4. Click on download besides Compressed TAR Archive and copy the Link Address from “No thanks, just start my download

 

5. Download the Setup file with the copied link

[mysql@test binary]$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz

 

6. Unzip and untar the file

[mysql@test binary]$ tar -zxvf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz

 

7. Create a softlink to the extracted file (optional)

[mysql@test binary]$ ln -s mysql-5.7.35-linux-glibc2.12-x86_64 5.7.35

 

8. Create the my.cnf file

vi /mysqldatabase/TEST/admin/my.cnf
[client]
port = 3306
socket = /mysqldatabase/TEST/admin/mysql.sock

[mysqld_safe]
log-error=/mysqldatabase/TEST/logs/mysql.log

[mysqld]
port = 3306
socket = /mysqldatabase/TEST/admin/mysql.sock
max_allowed_packet = 32M
query_cache_size = 32M
table_open_cache = 512K
sort_buffer_size = 4M
read_buffer_size = 2M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 4M
thread_cache_size = 25
sql_mode=ANSI,TRADITIONAL,NO_BACKSLASH_ESCAPES
log_output=TABLE
key_buffer_size = 32M
max_connections=100
tmp_table_size=32M
character_set_server=utf8
tmpdir=/mysqldatabase/TEST/tmp
max_heap_table_size=32M
join_buffer_size=4M
basedir=/mysqldatabase/product/binary/5.7.35
datadir=/mysqldatabase/TEST/data
default_storage_engine=InnoDB
innodb_file_per_table
log-bin=/mysqldatabase/TEST/binlogs/TEST-mysql-bin
log-bin-trust-function-creators=1
sync_binlog=1
binlog_format=mixed
server-id = 1
net_read_timeout = 60
innodb_data_home_dir = /mysqldatabase/TEST/data
innodb_data_file_path = ibdata1:200M;ibdata2:200M:autoextend
innodb_buffer_pool_size = 4096M
innodb_log_file_size = 1024M
innodb_log_buffer_size= 512M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 500

 

9. Install MySQL database

cd /mysqldatabase/product/binary/5.7.35
[mysql@test 5.7.35]$ bin/mysqld --defaults-file=/mysqldatabase/TEST/admin/my.cnf --initialize --user=mysql
2021-10-01T16:01:46.428149Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 1048686)
2021-10-01T16:01:46.428271Z 0 [Warning] Changed limits: table_open_cache: 457 (requested 524288)
2021-10-01T16:01:46.428597Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
 100 200
 100 200
 100 200 300 400 500 600 700 800 900 1000
 100 200 300 400 500 600 700 800 900 1000
2021-10-01T16:01:53.053944Z 0 [Warning] InnoDB: New log files created, LSN=45791
2021-10-01T16:01:53.113695Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-10-01T16:01:53.191290Z 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: e4fc1dfb-22d0-11ec-9497-0800271f22df.
2021-10-01T16:01:53.192417Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-10-01T16:01:53.923155Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2021-10-01T16:01:53.923182Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2021-10-01T16:01:53.928363Z 0 [Warning] CA certificate ca.pem is self signed.
2021-10-01T16:01:54.344747Z 1 [Note] A temporary password is generated for root@localhost: Mu,jT7!jC?=&

10. Get the root password
From the above the installation logs, you can get the root password. Here the temporary root password is Mu,jT7!jC?=&

11. Start the Instance and login to the instance to change the root password

[mysql@test 5.7.35]$ bin/mysqld_safe --defaults-file=/mysqldatabase/TEST/admin/my.cnf --user=mysql &

[mysql@test 5.7.35]$ /mysqldatabase/product/binary/5.7.35/bin/mysql -h127.0.0.1 -P3306 -uroot -p

( Use password from mysqld.log and change the password as mentioned )

mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'mysql';