Binary install MySQL5.7.17

Sohu mysql download address
    http://mirrors.sohu.com/mysql/MySQL-5.7/

System environment:

	[root@db02 ~]# uname -r
		2.6.32-696.el6.x86_64
	[root@db02 ~]# uname -m
		x86_64
	[root@db02 ~]# cat /etc/redhat-release 
		CentOS release 6.9 (Final)

Install

1. Create a directory

mkdir -p /server/tools
mkdir -p /application

# Upload mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz to /server/tools
# Upload mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5 to / server/tools

2. Verify that the installation package is intact and unzip it

[root@db02 tools]# md5sum -c mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz.md5 
	mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz: OK
[root@db02 ~]# cd /server/tools/
[root@db02 tools]# tar -zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
[root@db02 tools]# mv /server/tools/mysql-5.7.17-linux-glibc2.5-x86_64 /application/mysql-5.7.17

3. Create user mysql to manage Mysql5.7 database

useradd mysql -M -s /sbin/nologin 
id mysql

4. Authorization

chown -R mysql.mysql /application/mysql-5.7.17/

5. Initialize, record the temporary password generated in this step ( ******* must remember ******* )

[root@db02 tools]# /application/mysql-5.7.17/bin/mysqld --initialize --user=mysql --basedir=/application/mysql-5.7.17/ --datadir=/application/mysql-5.7.17/data
	2018-04-02T05:37:58.545594Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
	2018-04-02T05:38:00.301715Z 0 [Warning] InnoDB: New log files created, LSN=45790
	2018-04-02T05:38:00.490353Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
	2018-04-02T05:38:00.597912Z 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: 017f2649-3638-11e8-ab8f-000c29cb5b53.
	2018-04-02T05:38:00.601057Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
	2018-04-02T05:38:00.627614Z 1 [Note] A temporary password is generated for root@localhost: u_Z/qkry.0h3
######## 注意:A temporary password is generated for root@localhost: u_Z/qkry.0h3  
######## 生成了临时密码,要记住**************
[root@db02 tools]# echo $?
	0

6. Copy configuration files and startup files

cp /application/mysql-5.7.17/support-files/my-default.cnf /etc/my.cnf
cp /application/mysql-5.7.17/support-files/mysql.server /etc/init.d/mysqld-5.7.17
sed -i 's#/usr/local/mysql#/application/mysql-5.7.17#g' /application/mysql-5.7.17/bin/mysqld_safe /etc/init.d/mysqld-5.7.17

7. Start the mysql service and check the version

/etc/init.d/mysqld-5.7.17 start
/application/mysql-5.7.17/bin/mysql --version

8. Modify the password of the mysql user root. At this time, enter the temporary password u_Z/qkry.0h3

[root@db02 tools]# /application/mysql-5.7.17/bin/mysqladmin -uroot -p password '123'
	Enter password: 
	mysqladmin: [Warning] Using a password on the command line interface can be insecure.
	Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety

9. Clear command line records (optional)

history -c

Note: Readers can flexibly configure and install according to their own conditions, thank you for reading!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325548491&siteId=291194637