Mysql_5.7 binary compile free installation

Mysql_5.7 and Mysql_5.6 large difference

Mysql_5.7 installation steps

1. In the / usr/local/src directory, download the MySQL 64 bit package and extract it

[root@dl-001 src]# wget
[root@dl-001 src]# tar zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

2. Move the extracted data to / usr/local/mysql and enter the directory

[root@dl-001 src]# mv mysql-5.7.17-linux-glibc2.5-x86_64 /usr/local/mysql

[root@dl-001 src]# cd /usr/local/mysql

3. Create Mysql user and directory / data/mysql to store data and change attributes

[root@dl-001 mysql]# useradd mysql       
[root@dl-001 mysql]# mkdir -p /data/mysql
[root@dl-001 mysql]# chown -R mysql /data/mysql

4. Initialization

[root@dl-001 mysql]# bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
// There's a hint when you're done  A temporary password is generated for root@localhost: 7xYgMS,i(pne .   Back there root password.

5.cp profile address

[root@dl-001 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@dl-001 mysql]# cp support-files/my-default.cnf /etc/my.cnf

6. Change configuration file

[root@dl-001 mysql]# vim /etc/init.d/mysqld
[root@dl-001 mysql]# vim /etc/my.cnf
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
socket = /tmp/mysql.sock

7. Start

[root@dl-001 mysql]# /etc/init.d/mysqld start

Set password

//Use the initialization password to log in. After entering, set the password directly. Be sure to set a new password
[root@dl-001 mysql]# /usr/local/mysql/bin/mysql -uroot -p'3A)¥#LkcFP'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password = password('12#¥%6');   //Set password
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit     //sign out

Set the password when you know the initialization password

vi /etc/my.cnf

Add a line under [mysqld]


Restart / etc/init.d/mysqld restart

/usr/local/mysql/bin/mysql -uroot 

mysql> update user set authentication_string=password('123333') where user='root';

Change after exiting my.cnf Remove the newly added skip grant tables

Restart / etc/init.d/mysqld restart

The new password is now available.

Tags: MySQL Linux Oracle vim

Posted on Sun, 24 May 2020 08:07:19 -0700 by JWitness