centos7安装mysql-8.0.15

1.获取mysql
   wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
   (安装wget命令:yum install wget -y)
2.解压mysql
   xz -d mysql-8.0.15-linux-glibc2.12-x86_64.tar.xz
   tar -xvf mysql-8.0.15-linux-glibc2.12-x86_64.tar
3.移动文件到安装目录/usr/local/mysql
   mv mysql-8.0.15-linux-glibc2.12-x86_64 /usr/local/mysql
4.添加mysql用户
  adduser mysql
5.添加编辑/etc/my.cnf配置文件

[client]
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
# Skip #
skip_name_resolve = 1
skip_external_locking = 1
skip_symbolic_links = 1
# GENERAL #
user = mysql
default_storage_engine = InnoDB
character-set-server = utf8
socket = /usr/local/mysql/data/mysql.sock
pid_file = /usr/local/mysql/data/mysqld.pid
basedir = /usr/local/mysql
port = 3306
bind-address = 0.0.0.0
explicit_defaults_for_timestamp = off
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#read_only=on
# MyISAM #
key_buffer_size = 32M
#myisam_recover = FORCE,BACKUP

# undo log #
innodb_undo_directory = /usr/local/mysql/undo
innodb_undo_tablespaces = 8

# SAFETY #
max_allowed_packet = 100M
max_connect_errors = 1000000
sysdate_is_now = 1
#innodb = FORCE
#innodb_strict_mode = 1
secure-file-priv=‘/tmp‘
default_authentication_plugin=‘mysql_native_password‘
# Replice #
server-id = 1001
relay_log = mysqld-relay-bin
gtid_mode = on
enforce-gtid-consistency
log-slave-updates = on
master_info_repository =TABLE
relay_log_info_repository =TABLE

# DATA STORAGE #
datadir = /usr/local/mysql/data/
tmpdir = /tmp

# BINARY LOGGING #
log_bin = /usr/local/mysql/sql_log/mysql-bin
max_binlog_size = 1000M
binlog_format = row
binlog_expire_logs_seconds=86400
# sync_binlog = 1

# CACHES AND LIMITS #
tmp_table_size = 32M
max_heap_table_size = 32M
max_connections = 4000
thread_cache_size = 2048
open_files_limit = 65535
table_definition_cache = 4096
table_open_cache = 4096
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
# thread_concurrency = 24
join_buffer_size = 1M
# table_cache = 32768
thread_stack = 512k
max_length_for_sort_data = 16k

# INNODB #
innodb_flush_method = O_DIRECT
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
innodb_buffer_pool_size = 256M
#innodb_buffer_pool_instances = 8
innodb_stats_on_metadata = off
innodb_open_files = 8192
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 20000
innodb_thread_concurrency = 0
innodb_lock_wait_timeout = 60
innodb_old_blocks_time=1000
innodb_use_native_aio = 1
innodb_purge_threads=1
innodb_change_buffering=all
innodb_log_file_size = 64M
innodb_log_files_in_group = 2
innodb_data_file_path = ibdata1:256M:autoextend

innodb_rollback_on_timeout=on
# LOGGING #
log_error = /usr/local/mysql/sql_log/mysql-error.log
# log_queries_not_using_indexes = 1
# slow_query_log = 1
slow_query_log_file = /usr/local/mysql/sql_log/slowlog.log

# TimeOut #
#interactive_timeout = 30
#wait_timeout = 30
#net_read_timeout = 60

[mysqldump]
quick
max_allowed_packet = 100M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

6.生成data sql_log undo目录,并修改属主
   mkdir data sql_log undo
   chown mysql:mysql -R data/ sql_log/ undo/
7.将/user/local/mysql/bin路径添加到/etc/profile中
   export PATH=$PATH:/user/local/mysql/bin
   执行命令 source /etc/profile重启
8.初始化mysql
   mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
9.拷贝support-files目录下的mysql.server到/etc/init.d/mysqld
   cd /usr/etc/mysql/support-files
   cp mysql.server /etc/init.d/mysqld
10.启动mysql服务
   /etc/init.d/mysqld start
   查看mysql进程:ps -ef | grep mysql
11.查询初试密码sql_log/mysql-error.log
   cd /usr/local/mysql/sql_log
   grep password mysql-error.log
12.使用上面的初试密码登录mysql
   mysql -uroot -p
13.修改密码,这里密码设置为123456
  alter user user() identified by ‘123456‘;
14.设置外网可以连接
  mysql -u root -p
  进入mysql数据库:use mysql;
  查看user表中的数据:select Host, User from user;
  修改user表中的Host:update user set Host=‘%‘ where User=‘root‘;
  最后刷新一下:flush privileges;

原文地址:https://www.cnblogs.com/marshhu/p/12343229.html

时间: 2024-11-08 09:33:19

centos7安装mysql-8.0.15的相关文章

CentOS7 下源码安装MySQL 8.0.11

CentOS7 下源码安装MySQL 8.0.11 系统环境:CentOS7, 内核:Linux 3.10.0-862.el7.x86_64 如果有旧版本的MySQL,先卸载,用下面命令来查询出系统有哪些相关的MySQL包. rpm -qa | grep mysql 如果上述命令查询出有相关的MySQL包,就卸载 rpm -e 包名 卸载MariaDB包 yum remove mariadb-libs.x86_64 从MySQL官网下载源码包,并将该文件拷贝到系统中. https://dev.m

CentOS7安装配置redis-3.0.0

清园 沉没的Atlantis CentOS7安装配置redis-3.0.0 一.安装必要包 yum install gcc 二.linux下安装 #下载 wget http://download.redis.io/releases/redis-3.0.0.tar.gz tar zxvf redis-3.0.0.tar.gz cd redis-3.0.0 #如果不加参数,linux下会报错 make MALLOC=libc  安装好之后,启动文件 #启动redis src/redis-server

CentOS源码编译安装MySQL 5.5.15

CentOS源码编译安装MySQL 5.5.15 文章目录 [隐藏] 安装编译工具 下载源码 安装cmake和bison 编译安装MySQL 一些相关设置 安装编译工具 yum install gcc gcc-c++ yum install ncurses-devel 下载源码 mkdir -p /tmp cd /tmp wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mysql.

Centos 6.4上面用Shell脚本一键安装mysql 5.6.15

Centos 6.4上面用Shell脚本一键安装mysql 5.6.15  #!/bin/bash if [ `uname -m` == "x86_64" ];then machine=x86_64 else machine=i686 fi mysqlBasedir=/storage/server/mysql mysqlDatadir=${mysqlBasedir}/data/ mysqlLogdir=/storage/log/mysql mysqlUser=mysql mysqlGr

CentOS7 安装MongoDB 3.0服务器

CentOS7 安装MongoDB 3.0服务器 时间:2015-05-03 16:33来源:blog.csdn.net 作者:freewebsys 举报 点击:1449次 1,下载&安装 MongoDB 3.0 正式版本发布!这标志着 MongoDB 数据库进入了一个全新的发展阶段,提供强大.灵活而且易于管理的数据库管理系统.MongoDB宣称,3.0新版本不只提升7到10倍的写入效率以及增加80%的数据压缩率,还能减少95%的运维成本.  MongoDB 3.0主要新特性包括:  ·可插入式

win10 安装mysql 8.0.18 解决Navicat初次连接报错

win10 安装mysql 8.0.18 解决Navicat初次连接报错 win10 安装mysql 8.0.18-winx64 一,先去官网下载mysql 安装包 https://dev.mysql.com/downloads/mysql/ 3.管理员命令运行 命令行,进入mysql 安装包的 bin 目录(D:\MySQL\mysql-8.0.18-winx64\bin) 4.执行 命令 mysqld --initialize --console (会自动生成data 文件夹,且生成临时密码

安装 Mysql 8.0.x 的艰难体验

背景: Mysql 8.0 以后版本,在性能等方面有了很大提升,而且在自动编号.Timestamp等字段的设置上有了很方便的进步,因此在一年前即开始将原有的基于5.5版本的服务器逐渐向8.0.x 转移.但转移的过程问题颇多,主要的几个障碍如下: 1.需要各种visual c++ 的可发布版本:(8.0以后的小版本要求有所不同) 2.需要python 3.7版本.(8.0以后的小版本要求有所不同) 第一次安装时相对顺利,可能的原因是该服务器是一个“干净”的服务器,而且安装的是8.0.16版Mysq

centos7利用yum安装mysql 8.0.12

清理原有的mysql rpm -qa | grep mysql #可能的显示情况如下 #mysql-community-libs-8.0.12-1.el7.x86_64 #mysql80-community-release-el7-1.noarch #mysql-community-client-8.0.12-1.el7.x86_64 #mysql-community-common-8.0.12-1.el7.x86_64 #mysql-community-server-8.0.12-1.el7.

记录阿里云ECS(Centos7.4)安装mysql 8.0.X服务

#*.rpm介绍 大多数二进制rpm包都包含在名称中倒数第二个字段中编译rpm的体系结构..rpm软件包有那么几种 *.src.rpm 源程序包,要先通过编译才能安装 *.noarch.rpm 该包适用于任何架构 *.i*86.rpm 该包适用于intel cpu的电脑上运行 *.amd64.rpm 该包适用于amd64 cpu的电脑上运行 mysql各种源 传送门 https://repo.mysql.com/ 在这里,我选择mysql80-community-release-el7-1.no

centos7安装mysql(MariaDB)

1.centos7现状: 新系统无法再使用yum install mysql-server来安装mysql,因为已使用mariadb代替mysql. 2.安装mariadb: [[email protected] ~]# yum -y install mariadb* Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.linode.com * extras: mirro