CENTOS7 installation mysql5.7

Source: Internet
Author: User

1. Download MySQL

Website: http://dev.mysql.com/downloads/mysql/

2. Install SQL, put our downloaded RPM package into CENTOS7 (recommended with FileZilla tool)

Go to the directory to view the installation package

The installation sequence is

Mysql-community-common-5.7.16-1.el7.x86_64.rpmmysql-community-libs-5.7.16-1.el7.x86_64. Rpmmysql-community-libs-compat-5.7.16-1.el7.x86_64.rpmmysql-community-client-5.7.16-1.el7.x86_64. rpmmysql-community-server-5.7.16-1.el7.x86_64.rpm

Installation of the first common package

He will prompt an error, thinking that there are two dependent packages that are provided by mariadb-libs and cannot be installed repeatedly. So we need to uninstall MARIADB first.

[Email protected] mysql5.7.16]# rpm-e mariadb-libs-5.5.44-2.el7.centos.x86_64  --nodeps                 # # # Parameter--nodeps is a forced unload, whether or not a service cannot start after uninstallation. If you do not force an error display postfix cannot start

Then install the common package

Then install the Libs package

The following step by step normal installation is good, wherein MYSQL-COMMUNITY-LIBS-COMPAT-5.7.16-1.EL7.X86_64.RPM provides the files that let Postfix normally start

Installing server is an error because he still needs to rely on the package, but the dependencies he needs are on the disc, so we use Yum to install

[Root@localhost mysql5.7.16]# yum install-y/media/mysql5.7.16/mysql-community-server-5.7.16-1.el7.x86_64.rpm                    #####/media/mysql5.7.16/is my MySQL installation directory

3. Initialize MySQL

[Root@localhost mysql5.7.16]# mysql_install_db   --datadir=/var/lib/mysql                                                         # # #后面的datadir是指定初始化后的地方

4. Enter the/var/lib/mysql to see if the file is not MySQL will cause MySQL to not start, we want to modify the user and group

[Root@localhost mysql]# chown mysql:mysql  *-  R                                                                                   ##-r means recursion, and the file after the folder executes this command

5. Start SQL, but we do not know the initialization password. So to find the initialization password

Here are two cases where we have modified the file to belong to. In this case a hidden file in the home directory of the password needs to be performed Ls-la view

The second case is that we don't have a modified file, and he belongs to MySQL users and groups. In this case, his password is in/var/log/mysql.log.

Search a document for a te to see the password

6. Log in to SQL

7. Change the password, because the first time we login we must change the password

8. Setting up users and granting permissions

mysql> CREATE USER  ' lt ' @ ' 192.168.165.1 '  identified by ' 123456 '; Query OK, 0 rows Affected (0.00 sec)
Mysql>  Grant all  privileges on * * to  ' lt ' @ ' 192.168.165.1 '; Query OK, 0 rows Affected (0.00 sec)

9. Connect to the database

CENTOS7 installation mysql5.7

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.