一、优化部分

1、操作系统参数调优

2、数据库参数调优

3、防火墙设置等

二、安装部分

1、创建用户和组

# groupadd mysql
# useradd -g mysql mysql

2、到安装目录,解压安装文件

#cd /data
#tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
#mv mysql-5.7.19-linux-glibc2.12-x86_64 mysql

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

#mkdir  /data/mysql/data /data/mysql/log
#chown -R mysql:mysql /data/mysql

4、验证权限

# 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

5、编辑参数文件

vim /etc/my.cnf
[client]
port = 3306
socket = /data/mysql/data/mysql.sock
[mysqld]
server_id=10
port = 3306
user = mysql
character-set-server = utf8mb4
default_storage_engine = innodb
log_timestamps = SYSTEM
socket = /data/mysql/data/mysql.sock
basedir = /data/mysql
datadir = /data/mysql/data
pid-file = /data/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 = /data/mysql/log/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/log/mysql-slow.log
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

6、安装数据库

#  yum -y install libaio
# ./bin/mysqld --initialize --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data --innodb_undo_tablespaces=3 --explicit_defaults_for_timestamp

7、配置启动文件

cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start

8、配置环境变量

vi /etc/profile
#for mysql
mysql_home=/data/mysql
PATH=$PATH:$mysql_home/bin
source /etc/profile

9、查看默认密码

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

10、初始化密码

mysql -uroot -p‘xxxxx‘
SET PASSWORD=PASSWORD('root');
flush privileges;

11、数据库常规启停

#mysqladmin -uroot -proot shutdown
#mysqld_safe --defaults-file=/etc/my.cnf &
#ps -ef|grep mysql

12、安全配置

# 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!

相关阅读:

Mysql在各个系统的安装教程

Mysql 5.7.19 免安装版配置方法教程详解(64位)

Mysql 5.7.19 免安装版遇到的坑(收藏)

MySQL 5.7.19安装目录下创建my.ini文件的方法

转载于:https://blog.51cto.com/3161129/2117913

centos7+mysql5.7二进制安装相关推荐

  1. centos7 mysql二进制_centos7+mysql5.7二进制安装

    centos7+mysql5.7二进制安装 发布时间:2020-05-20 19:38:10 来源:51CTO 阅读:2641 作者:francisxys 一.优化部分 1.操作系统参数调优 2.数据 ...

  2. CentOS7.3下二进制安装Kubernetes1.9集群 开启TLS

    Kubernetes的相关原理性的东西之前有叙述过,网上也有很多,这里主要是写的自己在使用二进制的方式搭建Kubernetes1.9的一些方法,对学习的东西做一个自我的总结. Kubernetes有许 ...

  3. mysql5.5 二进制安装

    MySQL在linux上的二进制安装方法 建组.建用户: [root@dbking mysql]# groupadd mysql [root@dbking mysql]# useradd -g mys ...

  4. mysql5.5二进制安装,mysql5.5.28 通用二进制安装

    编译安装MySQL-5.5.28通用二进制 [iyunv@localhost local]# groupadd -r -g 306 mysql  为mysql创建一个系统用户 [iyunv@local ...

  5. MySQL5.X二进制安装

     一.MySQL5.X安装(MySQL下载)   1. 下载并上传软件至/server/tools [root@db01 /server/tools]# yum install -y lrzsz [r ...

  6. mysql5.7.10 二进制包_mysql 32 位安装教程mysql5.7 二进制包安装

    1. 下载包 wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz 2. 解压 ...

  7. 二进制安装mariadb-10.2.8

    centos7.3上二进制安装mariadb-10.2.8-linux-x86_64 1.查看是否安装mariadb rpm -qa mariadb* 如果已经安装就卸载. 2.下载mariadb最新 ...

  8. 二进制安装mysql集群_实战mysql集群搭建(一)--centos7下二进制安装mysql-5.6

    在超哥的帮助下,完成了基于InnoDb数据引擎的mysql数据库集群搭建,实现了主从复制的功能,本篇博文介绍如何使用二进制安装mysql的方法,具体实现步骤如下: 软件使用说明: Liunx系统:ce ...

  9. centos7下MySQL的安装(通用二进制安装)

    本篇博客是为下面安装hive做准备 MySQL安装的方法有三种(这里采用通用二进制安装) (29条消息) CentOS7安装MySQL的几种方法_神圣罗马帝国的博客-CSDN博客_centos7安装m ...

最新文章

  1. TVM如何训练TinyML
  2. 椭圆曲线加密算法(ECC)原理和C++实现源码(摘录)
  3. oracle开窗函数是什么,ORACLE数据库(六)-----开窗函数
  4. URL传Base64 造成报错 Illegal base64 character 20
  5. STM32 - 定时器的设定 - 基础 01 - Timer Base - Prescaler description - Upcounting mode
  6. Android官方技术文档翻译——Gradle 插件用户指南(5)
  7. python中文字符串排序问题_Python字符串排序
  8. 现在离开哈尔滨需要做核酸检测吗?
  9. java 返回泛型_Java返回类型泛型的用法小结 | 学步园
  10. 黑马程序员 Python学习笔记之PyCharm 的初始设置
  11. hdoj 5934 强连通分量+缩点 模版题(Java版)
  12. PythonTutor本地化运行
  13. 基于FPGA的ADS1256讲解
  14. 华为android7.0 root,华为Nova 7.0 root教程 华为Nova获取7.0系统的root权限
  15. Moment工具库学习
  16. 报表中的地图怎么做?
  17. 黑苹果 技嘉 B250M-DS3H-CF i57500 HD630 EFI引导驱动发布
  18. shader编程-三维场景下SDF建模,平滑交集、平滑并集、平滑差集(WebGL-Shader开发基础11)
  19. 计算机控制系统AD实验报告,实验一AD转换实验报告.docx
  20. JAVA的多线程、死锁、线程间通信、如何规避死锁、线程安全的单例模式

热门文章

  1. 如何在Java中获取系统属性?
  2. C#用yield模仿js的带 index的foreach
  3. Swift - 19 - 字典的初始化
  4. DNS篇之二DNS记录类型
  5. rsync+rsync+crond备份
  6. [转载] C#面向对象设计模式纵横谈——1. 面向对象设计模式与原则
  7. nginx的虚拟用户以及负载均衡
  8. 如何实现实时文本过滤
  9. 剑指offer——面试题15:链表中倒数第k个结点
  10. Ubuntu系统各个版本的镜像下载地址