Get the App
SLTechnology News&Howtos  ›  Database  › 

Introduction to the methods of how to install, deploy, initialize and create instances in mysql5.7

Shulou Source: shulou.com Published: 2022-06-01 19:19:13 10月03日 Update

This article mainly introduces how to install and deploy, initialize and create instances of mysql5.7. The content of the article is carefully selected and edited by the author, which is targeted and of great significance to everyone's reference. Let's learn how to install and deploy, initialize and create instances of mysql5.7 with the author.

A very simple process.

Environmental Information:

Centos 7.2

Mysql 5.7.21

1. Download the extracted mysql package

Cd / usr/local/wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gztar xzvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gzmv mysql-5.7.21-linux-glibc2.12-x86_64 mysql

two。 Initialize mysql basic environment information

Vim / etc/profilePATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATHexport PATHexport MYSQL_HOME= "/ usr/local/mysql" export ms= "/ usr/local/mysql"

3. Initialize configuration instance profile

Mkdir-p / usr/local/mysql/data/mcdbvi / usr/local/mysql/data/ my.cnf [client] port = 3310socket = / usr/local/mysql/data/mcdb/ mysql.sock [MySQL] no-auto- rehash [mysqld] user = mysqlport = / usr/local/mysql/data/mcdb/mysql.sockbasedir = / usr/local/mysqldatadir = / usr/local/mysql/datapid-file = / usr/local/mysql/data/mcdb/mysql.pidrelay-log = / usr/local/mysql/ Data/mcdb/relay-binrelay-log-info-file = / usr/local/mysql/data/mcdb/relay-log.infoserver-id = 12 [mysqld_safe] log-error = / usr/local/mysql/data/mcdb/mysql.errpid-file = / usr/local/mysql/data/mcdb/mysql.pid

4. New user

Groupadd mysqluseradd mysql-g mysqlchown mysql:mysql / usr/local/mysql-R

5. Initialize mysql instance

Mysqld-initialize-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data/mcdb-user=mysql

Get the password from the last line of the return message, take a chestnut:

YUlta1lw*uwF

6. Move the configuration file to the instance directory and start the instance mysql

Mv / usr/local/mysql/data/my.cnf / usr/local/mysql/data/mcdb/my.cnfmysqld_safe-defaults-file=/usr/local/mysql/data/mcdb/my.cnf-user=mysql-basedir=/usr/local/mysql-datadir=/usr/local/mysql/data/mcdb &

7. Log in to mysql

Mysql-uroot-pyUlta1lw*uwF-S / usr/local/mysql/data/mcdb/mysql.sock

8. Set password

Mysql > SET PASSWORD = PASSWORD ('hello2018'); mysql > flush privileges

9. Create a user and open remote login permissions

Grant all privileges on *. * to 'bodie'@'%' identified by' happybirthday' with grant option

After reading the above about how to install, deploy, initialize and create instances of mysql5.7, many readers must have some understanding. If you need more industry knowledge and information, you can continue to follow our industry information section.

Tags: Instance information method configuration password file environment user author industry login line content foundation meaning article more friends permissions columns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Redmi Shulou Tech Info MySQL