Mysql 5.7 Linux Installation detailed steps

Source: Internet
Author: User

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

1. Download the installation package
http://dev.mysql.com/downloads/mysql/#downloads
It is recommended to download the TAR package (Http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar) for the common installation method.
2. Check if the library file exists and delete it.
[Email protected] desktop]$ Rpm-qa | grep MySQL
Mysql-libs-5.1.52-1.el6_0.1.x86_64[[email protected] ~]# rpm-e mysql-libs-5.1.52.x86_64--nodeps
[Email protected] ~]#
3. Check that the MySQL group and the user are present, if not created.
[Email protected] ~]# Cat/etc/group | grep MySQL
mysql:x:490:
[Email protected] ~]# CAT/ETC/PASSWD | grep MySQL
Mysql:x:496:490::/home/mysql:/bin/bash
These are the default conditions, such as none, to execute the Add command:
[[Email protected] ~] #groupadd MySQL
[[Email protected] ~] #useradd-R-G MySQL MySQL
The Useradd-r parameter indicates that the MySQL user is a system user and cannot be used to log on to the system.
4. Unzip the TAR package to change the group and user to which it belongs
[Email protected] ~]# cd/usr/local/
[Email protected] local]# tar xvf mysql-5.7.12-linux-glibc2.5-x86_64.tar
[Email protected] local]# ls-l
Total 1306432
-rwxr--r--. 1 root root 668866560 June 1 15:07 Mysql-5.7.12-linux-glibc2.5-x86_64.tar
-rw-r--r--. 1 7161 wheel 638960236 Mar 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--. 1 7161 wheel 29903372 Mar 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz
[Email protected] local]# tar xvfz mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
[[Email protected] local]# mv mysql-5.7.12-linux-glibc2.5-x86_64 MySQL
[Email protected] local]# ls-l
Total 1306436
Drwxr-xr-x. 2 root root 4096 Dec 4 bin
Drwxr-xr-x. 2 root root 4096 Dec 4 etc
Drwxr-xr-x. 2 root root 4096 Dec 4 games
Drwxr-xr-x. 2 root root 4096 Dec 4 include
Drwxr-xr-x. 2 root root 4096 Dec 4 lib
Drwxr-xr-x. 3 root root 4096 Dec 2 14:36 lib64
Drwxr-xr-x. 2 root root 4096 Dec 4 libexec
Drwxr-xr-x. 9 7161 wheel 4096 Mar 12:51 MySQL
-rwxr--r--. 1 root root 668866560 June 1 15:07 Mysql-5.7.12-linux-glibc2.5-x86_64.tar
-rw-r--r--. 1 7161 wheel 638960236 Mar 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz
-rw-r--r--. 1 7161 wheel 29903372 Mar 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gz
Drwxr-xr-x. 2 root root 4096 Dec 4 sbin
Drwxr-xr-x. 6 root root 4096 Dec 2 14:36 share
Drwxr-xr-x. 2 root root 4096 Dec 4 src
[Email protected] local]# chown-r MySQL mysql/
[[email protected] local]# chgrp-r mysql mysql/[[email protected] local]# CD mysql/

5. Installing and initializing the database
[Email protected] mysql]# bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/ data/
2016-06-01 15:23:25 [WARNING] mysql_install_db is deprecated. Consider switching to mysqld--initialize
2016-06-01 15:23:30 [WARNING] The bootstrap log isn ' t empty:
2016-06-01 15:23:30 [WARNING] 2016-06-01t22:23:25.491840z 0 [WARNING]--bootstrap is deprecated. Please consider using--initialize instead
2016-06-01t22:23:25.492256z 0 [Warning] Changed limits:max_open_files:1024 (requested 5000)
2016-06-01t22:23:25.492260z 0 [Warning] Changed limits:table_open_cache:431 (requested)----------------------
If you change the default installation path, you will need to
1) Modification in/ETC/MY.CNF and/etc/init.d/mysqld
Basedir= '/apps/mysql '
Datadir= '/apps/mysql/data '
2) Create Ln
Mkdir-p/usr/local/mysql/bin
Ln-s/apps/mysql/bin/mysqld/usr/local/mysql/bin/mysqld
----------------------

[Email protected] mysql]#
[Email protected] mysql]# cp-a./support-files/my-default.cnf/etc/my.cnf
[Email protected] mysql]# cp-a./support-files/mysql.server/etc/init.d/mysqld
[Email protected] mysql]# CD bin/
[Email protected] bin]#/mysqld_safe--user=mysql &
[1] 2932
[Email protected] bin]# 2016-06-01t22:27:09.708557z mysqld_safe Logging to '/usr/local/mysql/data/ Localhost.localdomain.err '.
2016-06-01t22:27:09.854913z Mysqld_safe starting mysqld daemon with databases From/usr/local/mysql/data
[Email protected] bin]# /etc/init.d/mysqld Restart
Shutting down MySQL. 2016-06-01t22:27:50.498694z mysqld_safe mysqld from PID File/usr/local/mysql/data/localhost.localdomain.pid ended
success!
Starting MySQL. success!
[1]+ done./mysqld_safe--user=mysql
[Email protected] bin]#
Set boot up
[Email protected] bin]# chkconfig--level mysqld on
[Email protected] bin]#
6. Initialize Passwordmysql5.7 generates an initial password, and the previous version does not need to be logged on for the first login.
[Email protected] bin]# Cat/root/.mysql_secret
# Password set for user ' [e-mail protected] ' at 2016-06-01 15:23:25
, Xxxxxr5h9
[Email protected] bin]#./mysql-uroot-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 2
Server version:5.7.12
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> SET PASSWORD = PASSWORD (' 123456 ');
Query OK, 0 rows affected, 1 Warning (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

7. Add Remote access Permissions

mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a


Database changed
mysql> Update user Set host = '% ' where user = ' root ';
Query OK, 1 row Affected (0.00 sec)
Rows matched:1 changed:1 warnings:0


Mysql> Select Host, user from user;
+-----------+-----------+
| Host | user |
+-----------+-----------+
| %         | Root |
| localhost | Mysql.sys |
+-----------+-----------+
Restart takes effect
/etc/init.d/mysqld restart
Come from:http://blog.csdn.net/wb96a1007/article/details/51559741

Mysql 5.7 Linux Installation detailed steps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.