1.详细描安装的过程

1.1关闭防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

1.2 检查是否安装NySQL,如果安装 卸载之

rpm -qa |grep mysql
yum remove mysql*

1.3 检查是否安装MariaDB,如果安装 卸载之(重要)

rpm -qa |grep mariadb
yum remove mariadb*

1.4 新增用户/组 参数文件

groupadd mysql
useradd -d /home/mysql -g mysql -m mysql
passwd mysql
mysql vi ~/.bash_profile # .bash_profile # Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin:/u01/MySQL5.7/bin export PATH [mysql@localhost ~]$ source .bash_profile

1.5 规划目录 赋权限

mkdir -p /u01/MySQL5.7       

mkdir -p /MySQL/my3306/data
mkdir -p /MySQL/my3306/log/iblog
mkdir -p /MySQL/my3306/log/binlog
mkdir -p /MySQL/my3306/run
mkdir -p /MySQL/my3306/tmp chown -R mysql:mysql /MySQL/my3306
chown -R mysql:mysql /u01/MySQL5.7
##chown -R 755 /MySQL/my3307

1.6 下载mysql安装介质到目标机器

[root@localhost ~]# cd /u01/MySQL5.7
[root@localhost MySQL5.7]# ll
total 0
[root@localhost MySQL5.7]# ll
total 696028
-rw-r--r--. 1 mysql mysql 712729170 May 14 01:42 mysql-5.7.22-el7-x86_64.tar.gz

1.8 解压

[mysql@localhost  MySQL5.7]# tar -xzvf mysql-5.7.22-el7-x86_64.tar.gz  

[mysql@localhost MySQL5.7]# mv  /u01/MySQL5.7/mysql-5.7.22-el7-x86_64/* /u01/MySQL5.7/

1.9初始化数据库

[mysql@localhost ~]$ mysqld --initialize --user=mysql --basedir=/u01/MySQL5.7  --datadir=/MySQL/my3306/data  --explicit_defaults_for_timestamp
2018-05-14T05:52:52.741612Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2018-05-14T05:52:52.742026Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2018-05-14T05:52:53.946033Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-14T05:52:54.104581Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-14T05:52:54.201291Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0b79b507-573b-11e8-89dd-000c29a1762c.
2018-05-14T05:52:54.203218Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-14T05:52:54.210927Z 1 [Note] A temporary password is generated for root@localhost: ;c_tca9sR;s5

由上可知,初始化的root 密码为;c_tca9sR;s5

1.10编辑参数文件 my.cnf

vi /MySQL/my3306/my.cnf

[mysqld]
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
basedir=/u01/MySQL5.7 #介质目录
datadir=/MySQL/my3306/data #数据目录
port=3306 #端口
pid-file = /MySQL/my3306/data/mysql.pid #进程id
user = mysql #启动用户
socket=/MySQL/my3306/run/mysql.sock #sock文件地址
bind-address = 0.0.0.0 #绑定ip 这里表示绑定所有ip
server-id = 1 #用于复制环境钟标识实例,这个在复制环境里唯一
character-set-server = utf8 #服务端默认字符集,很重要,错误设置会出现乱码
max_connections = 1000 #允许客户端并发连接的最大数量
max_connect_errors = 6000 #如果客户端尝试连接的错误数量超过这个参数设置的值,则服务器不再接受新的客户端连接。
open_files_limit = 65535 #操作系统允许MySQL服务打开的文件数量。
table_open_cache = 128 #所有线程能打开的表的数量
max_allowed_packet = 4M #网络传输时单个数据包的大小。
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
log_error = /MySQL/my3306/data/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /MySQL/my3306/data/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800 [client]
port=3306
socket=/MySQL/my3306/run/mysql.sock [mysql]
socket=/MySQL/my3306/run/mysql.sock

1.11拷贝my.cnf 以及 mysql.server

cp /MySQL/my3306/my.cnf /etc/my.cnf
cp /u01/MySQL5.7/support-files/mysql.server /etc/init.d/mysqld

1.12编辑 /etc/init.d/mysqld

#添加一下两项
basedir=/u01/MySQL5.7
datadir=/MySQL/my3306/data

1.13.启动数据库

[mysql@localhost ~]$ service mysqld start
Starting MySQL.. SUCCESS!

1.14.连接数据库 更新初始密码

[mysql@localhost ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22-log Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
mysql>
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set PASSWORD=PASSWORD('root');
Query OK, 0 rows affected, 1 warning (0.03 sec) mysql> flush privileges;

1.15.配置mysql开机启动

[root@localhost ~]# chkconfig mysqld on
[root@localhost ~]# chkconfig Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

centos7 二进制安装MySQL5.7.22的更多相关文章

  1. CentOS-7下安装MySQL5.6.22

    参考: http://www.2cto.com/database/201501/371451.html 安装环境   CentOS版本:CentOS-7 因为之前安装过,没有成功,但是有之前安装的文件 ...

  2. 021-centos6.5上二进制安装mysql5.7.22

    思路: 下载上传mysql的二进制安装包. 准备好mysql的用户.安装目录basedir.数据目录datadir.配置文件/etc/my.cnf. 初始化出数据库. 配置启动服务. 开机启动. 配置 ...

  3. CentOS7.5安装Mysql5.7.22

    一 下载 下载地址:https://www.mysql.com/downloads/ 1 点击第一个链接地址,进入MySQL官方网站,单击“Downloads”下载Tab页,进入下载界面 2 找到Co ...

  4. centos7 二进制安装mysql5.6

    下载mysqltar包 wget -q http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.g ...

  5. CentOS7怎样安装MySQL5.7.22

    wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm下载mysql源安装包 yum install mysq ...

  6. Salt之CentOS7.5使用RPM包安装MySQL5.7.22

    手动安装参考CentOS7.5使用RPM包安装MySQL5.7.22 目录结构为 install.sls文件 #按顺序分别安装commin libs client server #避免冲突安装comm ...

  7. Linux(CentOS7)下二进制安装MySQL5.7.26

    记录一下自己在 CentOS7 下二进制安装 MySQL5.7.26 的过程,之前使用 Linux(CentOS7)下rpm安装MySQL8.0.16 之后发现 rpm 方式安装不利于维护,也不利于单 ...

  8. 在 CentOS7 上安装 MySQL5.7

    在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...

  9. Centos7 二进制安装 Kubernetes 1.13

    目录 1.目录 1.1.什么是 Kubernetes? 1.2.Kubernetes 有哪些优势? 2.环境准备 2.1.网络配置 2.2.更改 HOSTNAME 2.3.配置ssh免密码登录登录 2 ...

随机推荐

  1. vim中将tab 设置成4个空格

    在.vimrc中添加以下代码后,重启vim即可实现按TAB产生4个空格:set ts=4  (注:ts是tabstop的缩写,设TAB宽4个空格)set expandtab 对于已保存的文件,可以使用 ...

  2. poj3666&&bzoj1592

    题解: 和bzoj1367差不多 然后a[i]-i不用加 然后我再另一个地方加了这句话 然后poj ac,bzoj wa poj数据水啊 代码: #include<cstdio> #inc ...

  3. 谈一谈手机WebApp的fixed属性(手机上的固定栏)【转】

    1.iphone/android原生app常见结构 似乎,所有的手机应用,都遵循这样的布局:固定的顶部+固定的底部+可滚动在中间区域.这种“雷同”的模式让人恶心,却不得不承认这是一种很规矩却又很实用的 ...

  4. vue: alias

    resolve: { extensions: ['.js', '.vue', '.json'], alias: { '@': path.resolve('src') } }

  5. New Concept English Two 25 67

    $课文65  小象对警察 683. Last Christmas, the circus owner, Jimmy Gates, decided to take some presents to a ...

  6. 归并排序算法-Java实现

    简介: 归并(Merge)排序法是将两个(或两个以上)有序表合并成一个新的有序表,即把待排序序列分为若干个子序列,每个子序列是有序的.然后再把有序子序列合并为整体有序 基本思想: 将一个无序数组,利用 ...

  7. ThinkTemplate模板引擎的设计和使用方法

    在PHP开发的过程中,我们会接触到很多的模板引擎,包括FastTemplate.SmartTemplate.Smarty.tinybutstrong等,通常都是为了满足MVC开发模式的表现层需要,让显 ...

  8. 微信小程序页面跳转的四种方法

    wx.navigateTo({}) ,保留当前页面,跳转到应用内的某个页面,使用 wx.navigateBack 可以返回; 示例: 1 wx.navigateTo({ 2 url:'../test/ ...

  9. spring注解-@Autowired。@Resource。@Service

    Spring的@Autowired注解.@Resource注解和@Service注解 什么是注解 传统的Spring做法是使用.xml文件来对bean进行注入或者是配置aop.事物,这么做有两个缺点: ...

  10. SimpleDateFormat格式化日期以及日期的相关操作

    一.Java中的日期概述   日期在Java中是一块非常复杂的内容,对于一个日期在不同的语言国别环境中,日期的国际化,日期和时间之间的转换,日期的加减运算,日期的展示格式都是非常复杂的问题.   在J ...