centos mysql rpm re_centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解

centos环境安装mysql5.7

其实不建议安装mysql5.7 语法和配置可能和以前的版本区别较大,多坑,慎入

1.yum方式安装(不推荐)

a.安装mysql5.7 yum源

centos6:

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

yum localinstall mysql-community-release-el6-5.noarch.rpm

centos7:

wget dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

yum localinstall mysql57-community-release-el7-7.noarch.rpm

yum方式安装:

yum install mysql-community-server

2.rpm方式安装(推荐)

因yum源是在国外下载速度非常慢,建议直接下载后通过本地安装

centos6:

mysql-community-client-5.7.15-1.el6.x86_64.rpm

mysql-community-common-5.7.15-1.el6.x86_64.rpm

mysql-community-libs-5.7.15-1.el6.x86_64.rpm

mysql-community-server-5.7.15-1.el6.x86_64.rpm

centos7:

mysql-community-client-5.7.15-1.el7.x86_64.rpm

mysql-community-common-5.7.15-1.el7.x86_64.rpm

mysql-community-libs-5.7.15-1.el7.x86_64.rpm

mysql-community-server-5.7.15-1.el7.x86_64.rpm

yum localinstall -y mysql-community*.rpm

报错:

Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)

Requires: libmysqlclient.so.16(libmysqlclient_16)(64bit)

Removing: mysql-libs-5.1.71-1.el6.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)

libmysqlclient.so.16(libmysqlclient_16)(64bit)

Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/mysql-community-libs-5.7.15-1.el6.x86_64)

Not found

Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)

libmysqlclient.so.16(libmysqlclient_16)(64bit)

Error: Package: 2:postfix-2.6.6-6.el6_7.1.x86_64 (localyum)

Requires: libmysqlclient.so.16()(64bit)

Removing: mysql-libs-5.1.71-1.el6.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)

libmysqlclient.so.16()(64bit)

Obsoleted By: mysql-community-libs-5.7.15-1.el6.x86_64 (/mysql-community-libs-5.7.15-1.el6.x86_64)

Not found

Updated By: mysql-libs-5.1.73-7.el6.x86_64 (localyum)

libmysqlclient.so.16()(64bit)

You could try using --skip-broken to work around the problem

You could try running: rpm -Va --nofiles --nodigest

解决办法:

rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

1)默认 root 密码为空,其实不为空,使用 mysql -u root -p 进行登录失败

2)mysql_secure_installation这个初始化也不行

直接编辑mysql配置文件

vim /etc/my.cnf

加入

skip-grant-tables

注意:要加在[mysqld]的位置

重启数据库

#进入 mysql控制台

# mysql

可能的报错:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

解决办法:加上-h127.0.0.1

[root@node2 bin]# mysql -h127.0.0.1 -uroot -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.13 sec)

>use mysql;

# 修改密码

>update user set authentication_string = password('yourpasswd'), password_expired = 'N', password_last_changed = now() where user = 'root';

删掉skip-grant-tables,再次重启即可

添加用户时,报错,是因为密码策略的问题,我们只是测试,密码不需要那么复杂

mysql> grant all privileges on test.* to jack@'%' identified by "test";

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

修改密码策略即可

mysql> set global validate_password_policy=0;

mysql5.7开发环境的配置示例:

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

max_connections=1024

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_UNSIGNED_SUBTRACTION"

[client]

default-character-set = utf8mb4

[mysql]

default-character-set = utf8mb4

[mysqld]

character-set-client-handshake = FALSE

character-set-server = utf8mb4

collation_server = utf8mb4_general_ci

init_connect='SET NAMES utf8mb4'

ucloud mysql5.7配置:

[client]

default-character-set = utf8mb4

[mysql]

default-character-set = utf8mb4

[mysqld]

back_log = 2000

basedir = /opt/udb/program/mysql/mysql-5.7.12

bind-address = 127.0.0.1

binlog-format = MIXED

character-set-client-handshake = 0

character_set_server = utf8mb4

datadir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data

event_scheduler = ON

expire_logs_days = 7

general-log-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log

init_connect = 'SET NAMES utf8mb4'

innodb_buffer_pool_size = 377487360

innodb_data_file_path = ibdata1:100M:autoextend

innodb_data_home_dir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data

innodb_file_per_table = 1

innodb_flush_log_at_trx_commit = 2

innodb_flush_method = O_DIRECT

innodb_io_capacity = 2000

innodb_log_buffer_size = 8388608

innodb_log_file_size = 512M

innodb_log_files_in_group = 2

innodb_log_group_home_dir = /opt/udb/instance/mysql-5.7/xxxxxxxx/data

innodb_max_dirty_pages_pct = 50

innodb_open_files = 1024

innodb_read_io_threads = 8

innodb_thread_concurrency = 20

innodb_write_io_threads = 8

key_buffer_size = 33554432

local_infile = 1

log-bin = /opt/udb/instance/mysql-5.7/xxxxxxxx/binlog/mysql-bin.log

log-error = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log

log_bin_trust_function_creators = 1

log_output = TABLE

long_query_time = 3

max_allowed_packet = 16777216

max_connect_errors = 1000000

max_connections = 2000

myisam_sort_buffer_size = 8388608

net_buffer_length = 8192

performance_schema = 0

performance_schema_max_table_instances = 200

pid-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid

port = 3306

query_cache_size = 16777216

read_buffer_size = 262144

read_rnd_buffer_size = 524288

relay-log = /opt/udb/instance/mysql-5.7/xxxxxxxx/relaylog/mysql-relay.log

secure-file-priv = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp

server-id = 2130706433

skip-slave-start

skip_name_resolve

slave-load-tmpdir = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp

slave-parallel-type = LOGICAL_CLOCK

slave_parallel_workers = 8

slow-query-log-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysql-slow.log

slow_query_log = 1

socket = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.sock

sort_buffer_size = 524288

sql_mode = STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_UNSIGN

sync_binlog = 1

table_open_cache = 128

thread_cache_size = 50

tmpdir = /opt/udb/instance/mysql-5.7/xxxxxxxx/tmp

user = mysql

[mysqld_safe]

log-error = /opt/udb/instance/mysql-5.7/xxxxxxxx/log/mysqld.log

pid-file = /opt/udb/instance/mysql-5.7/xxxxxxxx/mysqld.pid

centos6.5环境安装mysql5.6

操作系统:centos6.5 x86_64

1.检查下linux是不是已经安装了mysql

rpm -qa | grep -i mysql

#如果安装了先卸载旧的版本

rpm -e --nodeps mysql...

2.下载需要的安装包,下载地址:

http://dev.mysql.com/downloads/mysql/5.6.html#downloads

MySQL-client-5.6.34-1.el6.x86_64.rpm

MySQL-devel-5.6.34-1.el6.x86_64.rpm

MySQL-server-5.6.34-1.el6.x86_64.rpm

全部安装

rpm -ivh MySQL-*.rpm

3.修改配置文件位置并做相关设置

cp /usr/share/mysql/my-default.cnf /etc/my.cnf

vi /etc/my.cnf

如果之前的版本有安装,需要重置root密码,可以在my.cnf的mysqld步伐加入,重启mysql,不输入密码即可进数据库

skip-grant-tables

密码默认位置:

# cat /root/.mysql_secret

4.初始化MySQL及设置密码

/usr/bin/mysql_install_db

service mysql start

可能碰到的错误:

明明已经修改了mysql.user表中的root密码,执行命令报错:

mysql> show databases;

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

mysql> use mysql;

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

解决办法:

mysql> SET PASSWORD = PASSWORD('123');

Query OK, 0 rows affected (0.00 sec)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/526860.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mysql galera haproxy_安装配置Haproxy代理MySQL Galera集群

这篇文章,我讲介绍如何为MariaDB Galera 集群添加负载均衡,大致步骤如下:确认所有Galera节点作为一个单一集群运行(所有节点都是主节点而且相互同步)安装Haproxy(你可以安装到独立的服务器或者应用服务器)配置集群监控检测脚本,用…

nvme固态硬盘开机慢_为何我使用了固态硬盘开机速度还是需要20-30秒

1、加速网上邻居在Windows XP中访问网上邻居是相当恼人的,系统会搜索自己的共享目录和可作为网络共享的打印机以及计划任务中和网络相关的计划任务,然后才显示出来,显然这样速度就会比Windows 9x中慢很多。其实这些功能我们并没有使用上&…

高性能mysql看不懂_高性能mysql笔记1

转载请注明&#xff1a;TheViper http://www.cnblogs.com/TheViper<>这本书写的真的很好&#xff0c;只可惜本屌不才&#xff0c;大部分都看不懂&#xff0c;暂且记下与mysql优化有关&#xff0c;对自己有用的东西。测试指标吞吐量吞吐量指的是单位时间内的事务处理数&am…

python 热词分析_Python笔记:热词分析2020-01-01

热词分析在公众趋势分析、舆情分析有很宽广的应用&#xff0c;我们来看看怎么从一个TXT文件中分析出文章的热词出来&#xff0c;我们采用流行的第三方“结巴”包来实现。首先安装第三方包(matplotlib&#xff0c;jieba&#xff0c;wordcloud&#xff0c;numpy)mmatplotlib主要来…

子进程会继承父进程的哪些内容_【学习教程】Node.js创建子进程方法

来源 | https://github.com/CommanderXL/biu-blog/issues/25exec其中exec可用于在指定的shell当中执行命令。不同参数间使用空格隔开&#xff0c;可用于复杂的命令。const { exec } require(child_process)exec(cat *.js bad_file | wc -l)exec方法用于异步创建一个新的子进程…

python元编程运用_Python 中的元编程

就像元数据是有关数据的数据一样&#xff0c;元编程就是编写用于操纵程序的某些程序。人们普遍认为&#xff0c;元程序就是生成其他程序的某些程序&#xff0c;但范式更加广泛。所有旨在自我读取、分析、转换或修改的程序都是元编程的范例。例如&#xff1a;领域特定语言 (DSL)…

wamp怎么安装mysql服务器_用wamp的mysq安装pythonmysql

(我不确定这是应该在这里问还是在苏。。但是看到this question就这样&#xff0c;我在这里要求它…)我在我的vista机器上安装了wamp(mysql-5.1.33)服务器&#xff0c;我正试图安装pythonmysql 1.2.3c1&#xff0c;以使用wamp提供的mysql版本。在起初&#xff0c;当我运行python…

mysql筛选两个表有相同项的数据库_用SQL查询两个表中相同的数据

展开全部 1、创建测试表; create table test_col_1(id number, var varchar2(200)); create table test_col_2(id number, var varchar2(200)); 2、插入测试数据, insert into test_col_1 select level*8, var||32313133353236313431303231363533e59b9ee7ad9431333431373839l…

MySQL建表添加乐观锁字段_Java秒杀系统优化-Redis缓存-分布式session-RabbitMQ异步下单-页面静态化...

Java秒杀系统优化-Redis缓存-分布式session-RabbitMQ异步下单-页面静态化项目介绍基于SpringBootMybatis搭建的秒杀系统&#xff0c;并且针对高并发场景进行了优化&#xff0c;保证线程安全的同时极大地提高了服务器的吞吐量&#xff0c;主要优化手段有页面静态化、Redis缓存(页…

叶金荣mysql教程_mysql优化--叶金荣老师讲座笔记

copy to tmp table执行ALTER TABLE修改表结构时建议&#xff1a;凌晨执行Copying to tmp table拷贝数据到内存中的临时表&#xff0c;常见于GROUP BY操作时建议&#xff1a;创建索引Copying to tmp table on disk临时结果集太大&#xff0c;内存中放不下&#xff0c;需要将内存…

mysql tpcc 测试结果分析_mysql 数据库TPCC测试

创建数据库tpcc&#xff0c;导入测试表格mysql -h 192.168.0.202 -P15002 -utest -ptest -e "drop database tpcc;"mysql -h 192.168.0.202 -P15002 -utest -ptest -e "create database tpcc;"mysql -h192.168.0.202 -P15002 -utest -ptest --databasetpcc…

mysql 变量生命周期_Go: 延长变量的生命周期

![Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.](https://raw.githubusercontent.com/studygolang/gctt-images2/master/20191002-Go-Keeping-a-Variable-Alive/00.png)本文基于 Go 1.13。在 Go 中&#xff0…

python qqbot实现qq聊天机器人_Python QQBot库的QQ聊天机器人

本文实例为大家分享了Python QQBot库的QQ聊天机器人的具体代码&#xff0c;供大家参考&#xff0c;具体内容如下1.安装pip install qqbot2.主动发出消息from qqbot import _bot as bot# 登录QQbot.Login([-q, 2816626661])buddy 获取指定名称/备注的好友group 获取群buddy bot…

tp5 mysql实现消息队列_TP5系列 | Queue消息队列

消费信息如下ThinkPHP5 Queue消息队列优点1、Queue内置了 Redis&#xff0c;Database&#xff0c;Topthink &#xff0c;Sync这四种驱动&#xff0c;本文使用Redis驱动2、Queue消息队列适用于大并发或者返回结果 时间有点长并需要批量操作的第三方接口&#xff0c;可用于短信发…

mysql表里插不进去数据_Oracle数据中表值插不进去问题(转)

相信我们在进行测试的时候&#xff0c;有的时候会遇上数据库表的值插不进去的情况&#xff0c;在执行&#xff33;&#xff31;&#xff2c;语句的时候&#xff0c;好像卡住一样&#xff0c;没有反应。但是当你把&#xff33;&#xff31;&#xff2c;语句&#xff43;&#xf…

java 类默认访问权限_Java类 成员 访问权限 默认

Java中的访问权限控制符有四个.作用域 当前类 同一package 子孙类 其他packagepublic √ √ √ √protected √ …

java创建临时文件夹_java创建临时文件

[java]代码库/*** 创建临时文件** param prefix* 临时文件名的前缀* param suffix* 临时文件名的后缀* param dirName* 临时文件所在的目录&#xff0c;如果输入null&#xff0c;则在用户的文档目录下创建临时文件* return 临时文件创建成功返回true&#xff0c;否则返回false*…

java quartz2.1_quartz 2.1学习(一)

quartz是一种开源任务调度框架&#xff0c;提供了强大的任务调度机制&#xff0c;Quartz允许开发人员灵活地定义触发器的调度时间表&#xff0c;并可对触发器和任务进行关联映射。废话不多说了&#xff0c;介绍一下编程的基本步骤&#xff1a;实现Job接口&#xff0c;编码实现需…

java http setheader_response.setHeader各种用法详解

本文主要介绍了response.setHeader各种用法。具有很好的参考价值&#xff0c;下面跟着小编一起来看下吧一秒刷新页面一次 response.setHeader("refresh","1");二秒跳到其他页面 response.setHeader("refresh","2;URLotherPagename");没…

datagridview取消默认选中_C# WinForm 取消DataGridView的默认选中Cell 使其不反蓝

dataGridView1.Rows[0].Selected false;默认情况下 DataGridView绑定数据后会选中首行首列为实现其没有默认不选中(即绑定后 看不到首行首列反蓝)之前将dataGridView1.Rows[0].Selected false;放在窗体的构造函数中 怎么都看似不起效果 首行首列还是反蓝后来尝试放在窗体的Lo…