MySQL 5.7 Installation

Source: Internet
Author: User

Description:
Database, there must be no more statements. In the database, the data is stored in a uniform format as a "record". Mainly has the following characteristics:
1, can be structured to store a large amount of data information, convenient for users to effectively search and access.
2, can effectively maintain the consistency of data information, integrity, reduce data redundancy.
3, can meet the sharing and security requirements of the application.
Below, for an example of the installation steps for a database

Experimental requirements: A CENTOS7 virtual machine for installing MySQL
.
.
The second step of the source package download
Link: Https://pan.baidu.com/s/19h1l3bSK1gv7cGUDk7zpOQ Password: YVJQ

.
.
1. First, the environment deployment, if the host to network, virtual network card is NAT mode
Yum install ncurses ncurses-devel Bison cmake gcc gcc-c++-y


.
.

2.
Useradd-s/sbin/nologin MySQL #设置管理MySQL服务进程用户
mkdir//uuu
Mount.cifs//192.168.200.1/GX/UUU # mount the local installation source inside the virtual machine
cd/uuu/
Tar zxvf mysql-5.7.17.tar.gz-c//
Tar zxvf boost_1_59_0.tar.gz-c/usr/local/#进行解压

.
.
3. cd/usr/local/
MV Boost_1_59_0 boost #将文件重命名 for easy operation

.
.

4. cd/mysql-5.7.17/
CMake \
-dcmake_install_prefix=/usr/local/mysql \ #安装目录
-dmysql_unix_addr=/usr/local/mysql/mysql.sock \ #通讯文件
-DSYSCONFDIR=/ETC \ #配置文件所在目录
-dsystemd_pid_dir=/usr/local/mysql \ #进程文件
-ddefault_charset=utf8 \ #字符集
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \ #字符集
-dwith_innobase_storage_engine=1 \
-dwith_archive_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwith_perfschema_storage_engine=1 \ #存储引擎
-dmysql_datadir=/usr/local/mysql/data \ #数据库文件
-dwith_boost=/usr/local/boost \ #支持库
-dwith_systemd=1
#会生成一个文件

.
.
5. Here's the make && makes install, which is a bit of a long process.

.
.
6. After installation is complete
Chown-r mysql:mysql/usr/local/mysql/#更改属组权限

.
.
7. Making configuration File Settings
Vim/etc/my.cnf
At the top, insert the following
[Client]
Port = 3306
Default-character-set=utf8
Socket =/usr/local/mysql/mysql.sock
[MySQL]
Port = 3306
Default-character-set=utf8
Socket =/usr/local/mysql/mysql.sock
Delete the following example 9 row and reinsert the following
[Mysqld]
user = MySQL #管理用户
Basedir =/usr/local/mysql #工作目录
DataDir =/usr/local/mysql/data #数据库文件
Port = 3306 #端口
Character_set_server=utf8 #字符集
Pid-file =/usr/local/mysql/mysqld.pid #进程文件
Socket =/usr/local/mysql/mysql.sock #连接文件
Server-id = 1 #本身id
Sql_mode=no_engine_substitution,strict_trans_tables,no_auto_create_user,no_auto_value_on_zero,no_zero_in_date, No_zero_date,error_for_division_by_zero,pipes_as_concat,ansi_quotes
#支持模式

.
.

8. cd/etc/
Chown mysql:mysql/etc/my.cnf #给予权限
Echo ' path=/usr/local/mysql/bin:/usr/local/mysql/lib: $PATH ' >>/etc/profile #将要识别命令, adding to system environment variables
echo ' Export PATH ' >>/etc/profile
Source/etc/profile #命令生效


.
.

9. Initializing the database
cd/usr/local/mysql/
BIN/MYSQLD \
--initialize-insecure \ #自动生成密码, blank password
--user=mysql \ #管理用户
--basedir=/usr/local/mysql \ #指定工作目录
--datadir=/usr/local/mysql/data #指定数据文件目录

.
.
10. cd/usr/local/mysql/usr/lib/systemd/system/
CP mysqld.service/usr/lib/systemd/system/#复制文件到指定目录下
Systemctl Daemon-reload #刷新识别
Systemctl Start mysqld #启动mysql
Systemctl Stop Firewalld.service #关闭防火墙
Setenforce 0
mysqladmin-u root-p Password "qwe123" #给root账号设置密码为qwe123 prompted to enter the original password.


.
.

11. Mysql-u root-p #使用root用户登录

Can log on, database installation is successful

MySQL 5.7 Installation

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.