Mysql5.7.21 Installation Documentation

Source: Internet
Author: User
Tags chmod

--1, create user group MySQL, create user MySQL and add it to user group MySQL, and give read and write permission

Groupadd MySQL--Create a MySQL user group group
Useradd-r-G MySQL MySQL--create MySQL user and add to MySQL user group
Chown-r MySQL mysql/--Assign MySQL directory access to MYQL users
Chgrp-r MySQL mysql/--the user group that changed the MySQL directory belongs to the MySQL group

--2, creating the installation directory
Mkdir-p/oracle/app/mysql/data
Chown-r Mysql.mysql/oracle/app/mysql

--3, upload MySQL files and unzip them
Cd/oracle/app/mysql
Mv/software/v974639-01.zip.
Unzip V974639-01.zip
Tar zxf mysql-advanced-5.7.21-el7-x86_64.tar.gz

--4, create configuration file, save and exit
Vim/etc/my.cnf
[Client]
Port = 3307
Socket =/oracle/app/mysql/data/mysql.sock
[Mysqld]
Character_set_server=utf8
init_connect= ' SET NAMES UTF8 '
Basedir=/oracle/app/mysql
Datadir=/oracle/app/mysql/data
Socket=/oracle/app/mysql/data/mysql.sock
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
Lower_case_table_names = 1
Sql_mode=strict_trans_tables,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_ Engine_substitution
max_connections=5000
Default-time_zone = ' the ' "

--5, initializing the database

--Create a log file
cd/var/log/
Vim Mysqld.log
: Wq
chmod 777 Mysqld.log
Chown Mysql:mysql Mysqld.log

--Initializing the database
/oracle/app/mysql/bin/mysqld--initialize--user=mysql--basedir=/oracle/app/mysql--datadir=/oracle/app/mysql/ Data--lc_messages_dir=/oracle/app/mysql/share--lc_messages=en_us

Note: You need to install Libaio
Yum Install Libaio

--6, view initialization password
Cat/var/log/mysqld.log
Last line: [email protected]: Here is the initial password

[Email protected]: A8#OH=PKFSF5

--7, start the MySQL service, modify the initial password, run the remote connection test
/oracle/app/mysql/support-files/mysql.server start
Set Password=password (' mysql5.7 ');
Flush privileges;
UPDATE ' MySQL '. ' User ' SET ' host ' = '% ', ' user ' = ' root ' WHERE (' Host ' = ' localhost ') and (' user ' = ' root ');

#然后执行如下操作开启mysql服务, and setting the relevant permissions
Cd/oracle/app/mysql/data

Vim Mysqld.pid
chmod 777 Mysqld.pid
Chown Mysql:mysql Mysqld.pid
/oracle/app/mysql/support-files/mysql.server start
/oracle/app/mysql/bin/mysql-uroot-p The initial password you saw on the top.


# here is the SQL statement after entering the database
Use MySQL;
UPDATE ' MySQL '. ' User ' SET ' Host ' = '% ', ' user ' = ' root ', ' select_priv ' = ' y ', ' insert_priv ' = ' y ', ' update_priv ' = ' y ', ' delete_ Priv ' = ' y ', ' create_priv ' = ' y ', ' drop_priv ' = ' y ', ' reload_priv ' = ' y ', ' shutdown_priv ' = ' y ', ' process_priv ' = ' y ', ' file_ ' Priv ' = ' y ', ' grant_priv ' = ' y ', ' references_priv ' = ' y ', ' index_priv ' = ' y ', ' alter_priv ' = ' y ', ' show_db_priv ' = ' y ', ' super_ ' Priv ' = ' y ', ' create_tmp_table_priv ' = ' y ', ' lock_tables_priv ' = ' y ', ' execute_priv ' = ' y ', ' repl_slave_priv ' = ' y ', ' repl_ ' Client_priv ' = ' y ', ' create_view_priv ' = ' y ', ' show_view_priv ' = ' y ', ' create_routine_priv ' = ' y ', ' alter_routine_priv ' = ' Y ', ' create_user_priv ' = ' y ', ' event_priv ' = ' y ', ' trigger_priv ' = ' y ', ' create_tablespace_priv ' = ' y ', ' ssl_type ' = ', ' Ssl_ Cipher ' = ', ' x509_issuer ' = ', ' x509_subject ' = ', ' max_questions ' = ' 0 ', ' max_updates ' = ' 0 ', ' max_connections ' = ' 0 ', ' Max ' _user_connections ' = ' 0 ', ' plugin ' = ' mysql_native_password ', ' authentication_string ' = ' * 7513fed7fefcad70e433ed117376d292d2d2b299 ', ' password_expired ' = ' N ', ' password_last_changed ' = ' 2018-4-12 12:41:07 ', ' Password_lifetime ' =null, ' account_locked ' = ' N ' where  (' User ' = ' root ');
Flush privileges;

--8, boot from boot
Cd/oracle/app/mysql/support-files
CP Mysql.server/etc/init.d/mysqld
Chkconfig--add mysqld

--9, using Systemctl start/stop mysqld.service to stop or start a service
Su-mysql
Systemctl Stop Mysqld.service
Systemctl Start Mysqld.service
Note: You need to enter the root account password in Linux

--Establish a remote user
Grant all privileges on * * to ' padmin ' @ ' percent ' identified by ' padmin ';
Flush privileges;

--Add system path
Vim/etc/profile
Export Path=/oracle/app/mysql/bin: $PATH
Source/etc/profile





This article refers to related articles on the web.

Mysql5.7.21 Installation Documentation

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.