centos7 二进制安装MySQL5.7.22
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的更多相关文章
- CentOS-7下安装MySQL5.6.22
参考: http://www.2cto.com/database/201501/371451.html 安装环境 CentOS版本:CentOS-7 因为之前安装过,没有成功,但是有之前安装的文件 ...
- 021-centos6.5上二进制安装mysql5.7.22
思路: 下载上传mysql的二进制安装包. 准备好mysql的用户.安装目录basedir.数据目录datadir.配置文件/etc/my.cnf. 初始化出数据库. 配置启动服务. 开机启动. 配置 ...
- CentOS7.5安装Mysql5.7.22
一 下载 下载地址:https://www.mysql.com/downloads/ 1 点击第一个链接地址,进入MySQL官方网站,单击“Downloads”下载Tab页,进入下载界面 2 找到Co ...
- 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 ...
- CentOS7怎样安装MySQL5.7.22
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm下载mysql源安装包 yum install mysq ...
- Salt之CentOS7.5使用RPM包安装MySQL5.7.22
手动安装参考CentOS7.5使用RPM包安装MySQL5.7.22 目录结构为 install.sls文件 #按顺序分别安装commin libs client server #避免冲突安装comm ...
- Linux(CentOS7)下二进制安装MySQL5.7.26
记录一下自己在 CentOS7 下二进制安装 MySQL5.7.26 的过程,之前使用 Linux(CentOS7)下rpm安装MySQL8.0.16 之后发现 rpm 方式安装不利于维护,也不利于单 ...
- 在 CentOS7 上安装 MySQL5.7
在 CentOS7 上安装 MySQL5.7 1 通过 SecureCRT 连接到阿里云 CentOS7 服务器: 2 进入到目录 /usr/local/ 中: cd /usr/local/ 3 创建 ...
- Centos7 二进制安装 Kubernetes 1.13
目录 1.目录 1.1.什么是 Kubernetes? 1.2.Kubernetes 有哪些优势? 2.环境准备 2.1.网络配置 2.2.更改 HOSTNAME 2.3.配置ssh免密码登录登录 2 ...
随机推荐
- Java解析Json数据的两种方式
JSON数据解析的有点在于他的体积小,在网络上传输的时候可以更省流量,所以使用越来越广泛,下面介绍使用JsonObject和JsonArray的两种方式解析Json数据. 使用以上两种方式解析json ...
- PostgresException: 42883: function ifnull(integer, integer) does not exist
原因在于PostGresql并没有自带IFNULL函数,可以用COALESCE来替代IFNULL,且COALESCE功能更强大,可以输入更多参数,顺序判断并返回第一个非null值. 例如: SELEC ...
- SQL Server 创建角色和账号
/*--示例说明 示例在数据库pubs中创建一个拥有表jobs的所有权限.拥有表titles的SELECT权限的角色r_test 随后创建了一个登录l_test,然后在数据库p ...
- generator.xml文件与相关配置插件
一,generator.xml配置信息 1 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ...
- Gakki赛高-团队介绍
队名:Gakki赛高 队员学号(标记组长): 张朝玮(组长)201521123106 张翔 201521123107 陈伟泽 201521123111 李嘉廉 201521123091 侯帅军 201 ...
- 转asp.net中的App_GlobalResources和App_LocalResources使用
asp.net中的App_GlobalResources和App_LocalResources使用 App_GlobalResources是全局资源文件夹,主要存放一些所有页面都需要用到的信息.App ...
- Zabbix(Windows)
Windows环境下只能装客户端, 而不能装服务端; zabbix官网 https://www.zabbix.com/ 下载并解压到本地 修改配置文件: # Hostname=Hostname=DES ...
- 那些实用的Nginx规则
1. 概述 大家都知道Nginx有很多功能模块,比如反向代理.缓存等,这篇文章总结下我们这些年实际环境中那些有用的Nginx规则和模块,大部分是用法的概括及介绍,具体细节在实际配置时再自行google ...
- linux bash shell 判断目录是否为空的函数
#!/bin/sh ##方法一 判断输出字符数统计为0 is_empty_dir(){ |wc -w` } ##方法二 判断输出string为空 #is_empty_dir(){ # ` ] #} t ...
- 由spring的工厂构造bean想到的
被Spring管理的bean可以是直接创建实例,还可以通过工厂模式来进行创建.例如brave的tracing bean定义: <bean id="tracing" class ...