Linux CentOS7 Installation Mysql5.7

Source: Internet
Author: User

First, download MySQL

Mkdir/home/install #创建install目录

Download mysql5.7 in the/home/install directory

wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

  

Download complete

  

Second, extract to/USR/LOCAL/MSYQL

Decompression TAR-ZXVF mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz

  

Move to/usr/local/mysql

MV Mysql-5.7.23-linux-glibc2.12-x86_64/usr/local/mysql

Third, create the relevant directory

1. Create a storage directory

Mkdir/usr/local/mysql/data

  

Iv. new user, user group, user directory

1. Create a user group

Groupadd MySQL

  

2. Create a non-logged-in user and add a directory

Useradd-r-s/sbin/nologin-g MySQL mysql-d/usr/local/mysql/

  

3. Changing directory Properties

Chown-r Mysql/usr/local/mysql

Chgrp-r Mysql/usr/local/mysql

  

Five, configuration parameters

1. Initialize, record the initial password fysvgm0.ja6e

/usr/local/mysql/bin/mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data

  

2. Turn on SSL

/usr/local/mysql/bin/mysql_ssl_rsa_setup--datadir=/usr/local/mysql/data

  

3. Modify/ETC/MY.CNF

Vim/etc/my.cnf

Delete the contents of the/etc/my.cnf change to

  

4. Modify the Boot configuration file

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

Vim/etc/init.d/mysql

Join

Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data

  

5. Establishing a MySQL shortcut command connection

Ln-s/usr/local/bin/mysql/usr/bin

  

Six, start, connect, test

1. Start the command

Service mysqld Start

Or

Service mysqld Start

Or

/usr/local/mysql/support-files/mysql.server start

  

2. Connect

Mysql-uroot-p

  

3. Reset Password

Set password = password (' 123456 ');

  

4. Set root account permissions to support remote connections

Mysql> Grant all privileges on * * to ' root ' @ '% ' identified by ' 123456 ';

Flush privileges;

  

Vii. Other Configurations

1. Firewall Problem Reference: https://www.cnblogs.com/zwcry/p/9457435.html

2. Set boot boot (can also use Sytemctl to do the boot service, Baidu)

chmod 775/etc/init.d/mysql

Chkconfig--add MySQL

Chkconfig--level 345 MySQL on

  

Linux 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.