mysql5.7 deployment, initialization, and creation of instances

Source: Internet
Author: User

It's a simple process.

Environmental information:
CentOS 7.2
MySQL 5.7.21

1. Download the uncompressed 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

2. Initializing MySQL Basic environment information

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

3. Initializing the configuration instance configuration file

mkdir -p /usr/local/mysql/data/mcdbvi /usr/local/mysql/data/mcdb/my.cnf
[client]port = 3310socket = /usr/local/mysql/data/mcdb/mysql.sock[mysql]no-auto-rehash[mysqld]user = mysqlport = 3310socket = /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. Create a new user

groupadd mysqluseradd mysql -g mysqlchown mysql:mysql /usr/loca/mysql -R

5. Initializing MySQL instance
mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/mcdb --user=mysql --ldata=/usr/local/mysql
Get the password from the last line of the return message, for a chestnut:
Yulta1lw*uwf

6. Start the instance MySQL
mysqld_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 the password

mysql> SET PASSWORD = PASSWORD(‘sonyw320‘); mysql> flush privileges;

9. Create users and open remote login permissions
grant all privileges on *.* to ‘bodie‘@‘%‘ identified by ‘happybirthday‘ with grant option;

mysql5.7 deployment, initialization, and creation of instances

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.