mysql 5.7.19 二进制最新安装

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,高可用系列 2核4GB
简介:

##############################

2017-08-08  笔记

一、优化部分

1.操作系统参数调优

2.数据库参数调优

3.防火墙设置等

#############################

二、安装部分

1.创建用户和组

# groupadd mysql

# useradd -g mysql mysql


2.创建数据库安装目录、授权

# mkdir /mysql /mysql/data /mysql/log 

# chown -R mysql:mysql /usr/local/mysql 


3.到安装目录,解压安装文件

#cd /usr/local

# tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz

# mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql


4.授权

# chown -R mysql.mysql mysql


5.验证权限

# ls -l mysql

total 52

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 bin

-rw-r--r--  1 mysql mysql 17987 Jun 22 22:13 COPYING

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 docs

drwxr-xr-x  3 mysql mysql  4096 Aug  8 04:06 include

drwxr-xr-x  5 mysql mysql  4096 Aug  8 04:06 lib

drwxr-xr-x  4 mysql mysql  4096 Aug  8 04:06 man

-rw-r--r--  1 mysql mysql  2478 Jun 22 22:13 README

drwxr-xr-x 28 mysql mysql  4096 Aug  8 04:06 share

drwxr-xr-x  2 mysql mysql  4096 Aug  8 04:06 support-files


6.编辑参数文件

vim /etc/my.cnf


[client]

port = 3306

socket = /tmp/mysql.sock


[mysqld]

server_id=10

port = 3306

user = mysql

character-set-server = utf8mb4

default_storage_engine = innodb

log_timestamps = SYSTEM

socket = /tmp/mysql.sock

basedir = /usr/local/mysql

datadir = /mysql/data

pid-file = /mysql/data/mysql.pid

max_connections = 1000

max_connect_errors = 1000

table_open_cache = 1024

max_allowed_packet = 128M

open_files_limit = 65535

#####====================================[innodb]==============================

innodb_buffer_pool_size = 1024M

innodb_file_per_table = 1

innodb_write_io_threads = 4

innodb_read_io_threads = 4

innodb_purge_threads = 2

innodb_flush_log_at_trx_commit = 1

innodb_log_file_size = 512M

innodb_log_files_in_group = 2

innodb_log_buffer_size = 16M

innodb_max_dirty_pages_pct = 80

innodb_lock_wait_timeout = 30

innodb_data_file_path=ibdata1:1024M:autoextend

innodb_undo_tablespaces=3

#####====================================[log]==============================

log_error = /mysql/log/mysql-error.log 

slow_query_log = 1

long_query_time = 1 

slow_query_log_file = /mysql/log/mysql-slow.log

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES



7.安装数据库

# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/data  --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp


8.配置启动文件

cp support-files/mysql.server /etc/init.d/mysql

chkconfig --add mysql

chkconfig mysql on

service mysql start


9.配置环境变量


vi /etc/profile

#for mysql  

mysql_home=/usr/local/mysql

PATH=PATH:mysql_home/bin

source /etc/profile


10.查看默认密码

grep -i password /mysql/log/mysql-error.log 


11.初始化密码

mysql -uroot -p'xxxxx'

SET PASSWORD=PASSWORD('root');

flush privileges;


12.数据库常规启停

# mysqladmin -uroot -proot shutdown

#mysqld_safe --defaults-file=/etc/my.cnf &

#ps -ef|grep mysql



13.安全配置

# mysql_secure_installation 

Securing the MySQL server deployment.


Enter password for user root: 


VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?


Press y|Y for Yes, any other key for No: y


There are three levels of password validation policy:


LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file


Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

Using existing password for root.


Estimated strength of the password: 25 

Change the password for root ? ((Press y|Y for Yes, any other key for No) : y


New password: 


Re-enter new password: 

Sorry, passwords do not match.


New password: 


Re-enter new password: 

Sorry, passwords do not match.


New password: 


Re-enter new password: 


Estimated strength of the password: 50 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

 ... Failed! Error: Your password does not satisfy the current policy requirements


New password: 


Re-enter new password: 


Estimated strength of the password: 100 

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.


Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Success.



Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.


Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

Success.


By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.



Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

 - Dropping test database...

Success.


 - Removing privileges on test database...

Success.


Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.


Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

Success.


All done! 











本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/1954372,如需转载请自行联系原作者
相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
235
分享
相关文章
容器技术实践:在Ubuntu上使用Docker安装MySQL的步骤。
通过以上的操作,你已经步入了Docker和MySQL的世界,享受了容器技术给你带来的便利。这个旅程中你可能会遇到各种挑战,但是只要你沿着我们划定的路线行进,你就一定可以达到目的地。这就是Ubuntu、Docker和MySQL的灵魂所在,它们为你开辟了一条通往新探索的道路,带你亲身感受到了技术的力量。欢迎在Ubuntu的广阔大海中探索,用Docker技术引领你的航行,随时准备感受新技术带来的震撼和乐趣。
46 16
MySQL日志详解——日志分类、二进制日志bin log、回滚日志undo log、重做日志redo log
MySQL日志详解——日志分类、二进制日志bin log、回滚日志undo log、重做日志redo log、原理、写入过程;binlog与redolog区别、update语句的执行流程、两阶段提交、主从复制、三种日志的使用场景;查询日志、慢查询日志、错误日志等其他几类日志
156 35
MySQL日志详解——日志分类、二进制日志bin log、回滚日志undo log、重做日志redo log
Docker Compose V2 安装常用数据库MySQL+Mongo
以上内容涵盖了使用 Docker Compose 安装和管理 MySQL 和 MongoDB 的详细步骤,希望对您有所帮助。
226 42
CentOS7仅安装部署MySQL80客户端
通过上述步骤,你可以在CentOS 7上成功安装并配置MySQL 8.0客户端。这个过程确保你能够使用MySQL客户端工具连接和管理远程的MySQL数据库,而不需要在本地安装MySQL服务器。定期更新MySQL客户端可以确保你使用的是最新的功能和安全修复。
347 16
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
在这一章节,主要介绍两个部分,数据库相关概念及MySQL数据库的介绍、下载、安装、启动及连接。接着,详细描述了MySQL 8.0的版本选择与下载,推荐使用社区版(免费)。安装过程包括自定义安装路径、配置环境变量、启动和停止服务、以及客户端连接测试。此外,还提供了在同一台电脑上安装多个MySQL版本的方法及卸载步骤。最后,解释了关系型数据库(RDBMS)的特点,即基于二维表存储数据,使用SQL语言进行操作,格式统一且便于维护。通过具体的结构图展示了MySQL的数据模型,说明了数据库服务器、数据库、表和记录之间的层次关系。
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
《docker高级篇(大厂进阶):1.Docker复杂安装详说》包括:安装mysql主从复制、安装redis集群
160 14
docker高级篇(大厂进阶):安装mysql主从复制
docker高级篇(大厂进阶):安装mysql主从复制
145 24
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
《docker基础篇:8.Docker常规安装简介》包括:docker常规安装总体步骤、安装tomcat、安装mysql、安装redis
179 7
Windows Server 安装 MySQL 8.0 详细指南
安装 MySQL 需要谨慎,特别注意安全配置和权限管理。根据实际业务需求调整配置,确保数据库的性能和安全。
472 9
Linux安装jdk、mysql、redis
Linux安装jdk、mysql、redis
284 7