centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解
centos环境安装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)
centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解的更多相关文章
- CentOS6.8 下RPM方式安装MySQL5.6
1. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) yum remove mysql mysql-server mysql-libs(我用的上面的)或者 [root ...
- centos6.7环境之kvm虚拟化quem工具配置及使用详解
环境准备 需要勾选CPU的虚拟化支持,支持cpu虚拟化的CPU列表: intel支持虚拟化技术CPU列表: Intel 6 Cores / 12 Threads CPU Number: Code Na ...
- Centos6.4 用rpm方式安装MySql5.6
1.查看系统是否安装了MySQL 使用命令: #rpm -qa | grep mysql 2.卸载已安装的MySQL 卸载mysql命令如下: #rpm - ...
- CentOS6.5下RPM方式安装mysql5.6.33
1.mysql下载 下载地址:https://dev.mysql.com/downloads/mysql/5.6.html下载以下安装包: MySQL-client-5.6.33-1.el6.x86_ ...
- Centos6.6 以rpm方式安装mysql5.6
一.查看系统中有没有mysql的源 yum repolist all | grep mysql 二.配置源 1.配置源参考mysql官方给出的源配置,https://dev.mysql.com/doc ...
- linux(centos6.9)下rpm方式安装mysql后mysql服务无法启动
以下两种方式启动都报错:启动失败: [root@node03 ~]# service mysqld startMySQL Daemon failed to start.Starting mysqld: ...
- CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]
一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...
- 关于centos7中使用rpm方式安装mysql5.7版本后无法使用root登录的问题
最近在centos7中通过rpm方式安装了最新版本的mysql-server 5.7 (mysql57-community-release-el7-7.noarch.rpm) ,发现安装成功后无法使用 ...
- RPM方式安装MySQL5.6和windows下安装mysql解压版
下载地址: http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpmhttp://cdn.mysql.c ...
随机推荐
- A1059. Prime Factors
Given any positive integer N, you are supposed to find all of its prime factors, and write them in t ...
- 【洛谷P4113】采花 HH的项链+
题目大意:静态统计序列区间中出现次数大于等于 2 的颜色数. 题解:类似于HH的项链,只需将 i 和 pre[i] 的关系对应到 pre[i] 和 pre[pre[i]] 的关系即可. 代码如下 #i ...
- code::Blocks生成的dll 在 java jni 调用遇到的问题
Test.java__________________________________ public class Test{ public static native void p(); pub ...
- 搭建一个简单的node.js服务器
第一步:安装node.js.可以去官网:https://nodejs.org/en/进行下载. 查看是否成功,只需在控制台输入 node -v.出现版本号的话,就证明成功了. 第二步:编写node.j ...
- 面板 JPanel,滚动面板 JScrollPane,文本域JTextArea
容器中可以有多个JPanel面板,一个JPanel面板中可以有多个控件. 滚动面板 JScrollPane中只能有一个控件. public class Demo extends JFram ...
- 静态代码块、构造代码块、构造方法优先级(重点)-------java基础总结
package com.mon11.day11; /** * 类说明 : * @author 作者 : chenyanlong * @version 创建时间:2017年11月11日 */ publi ...
- Django xadmin引入DjangoUeditor
Django xadmin引入DjangoUeditor 版本:python3.6.1,Django1.11.1 DjangoUeditor下载地址:https://github.com/twz915 ...
- 强大的svg操作库——Raphael
先常规先引入Raphael库: <script src="raphael.js" type="text/javascript"></scrip ...
- SSD详解
This results in a significant improvement in speed for high-accuracy detection(59 FPS with mAP 74.3% ...
- spring集成ActiveMQ居然要依赖这么多包
做spring和ActiveMQ的集成,作maven依赖的时候有感(以前都不在乎,现在不一样了........省略) <!-- https://mvnrepository.com/artifac ...