背景

没啥好说的,就是需要搭建自己的测试数据库跟研发的数据隔离开来,需要怼mysql

这个方法只适合mysql5.7

# mysql5.6的有差异

步骤

1. 确认线上mysql的版本

SELECT VERSION();

2. 确认安装方式,其实yum命令也可以直接安装,厉害了,但这样安装的话,配置不方便,一般不推荐,直接用tar.gz包来安装吧

3 .创建源包目录

mkdir -p /home/jwen/local/mysql-5.7.

4. 下载源

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar

5.解压

tar xvf mysql-5.7.-linux-glibc2.-x86_64.tar

6.解压mysql包

tar -xzvf mysql-5.7.-linux-glibc2.-x86_64.tar.gz

7. 创建软链接

ln -s /home/jwen/local/mysql-5.7./mysql-5.7.-linux-glibc2.-x86_64 /home/jwen/local/mysql

8. 创建数据库目录

mkdir -p /home/jwen/local/mysql/data/

9.MYSQL初始化

./mysqld --initialize --user=jwen --basedir=/home/jwen/local/mysql --datadir=/home/jwen/local/mysql/data/

此处需要注意记录生成的临时密码,如上文:YLi>7ecpe;YP

10.SSL配置

./mysql_ssl_rsa_setup --datadir=/home/jwen/local/mysql/data/

11.修改配置文件,需要root权限

# cp my-default.cnf /etc/my.cnf
# cp mysql.server /etc/init.d/mysql

# vim /etc/init.d/mysql

修改以下内容:

basedir=/home/jwen/local/mysql

datadir=/home/jwen/local/mysql/data/
# vim /etc/my.cnf

修改以下内容:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
port=
socket=/home/jwen/local/mysql/mysql.sock
#character-set-server=utf8 [mysqld] # Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin # These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = ..... # Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
socket=/home/jwen/local/mysql/mysql.sock
basedir=/home/jwen/local/mysql
max_allowed_packet=32M
explicit_defaults_for_timestamp=true
skip-ssl
secure-file-priv=NULL
back_log=
max_connections=
max_connect_errors=
table_open_cache=
external-locking=FALSE
###*** slow query parameters
long_query_time=
slow_query_log
slow_query_log_file=/home/jwen/logs/mysql/slow.log sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqldump]
quick
max_allowed_packet=32M [mysqld_safe]
open-files-limit=
log-error=/home/jwen/logs/mysql/mysql_3306.err

手动创建不存在的目录

mkdir -p /home/jwen/logs/mysql

12.切换root用户(执行完后,退出到nemo用户)

创建目录

mkdir -p /usr/local/mysql/bin

创建目录

mkdir -p /usr/local/mysql/data

修改目录用户/目录组

chown -R jwen:jwen /usr/local/mysql

修改配置文件的用户与组:

chown jwen:jwen /etc/my.cnf

13.创建软连接

ln -s /home/jwen/local/mysql/bin/mysqld /usr/local/mysql/bin/mysqld

14.启动mysql

 ./mysqld_safe  --defaults-file=/etc/my.cnf --datadir=/home/jwen/local/mysql/data/ --user=mysql &

15.登录mysql

 ./mysql --user=root -p

--输入第7步生成的临时密码

16.修改密码

mysql> set password=password('rootP@123');

密码为rootP@123

17.修改root用户的权限

mysql> grant all privileges on *.* to root@'%' identified by 'rootP@123';
mysql> flush privileges;

18.验证

mysql> use mysql;
mysql> select host,user from user;

19.创建用户

insert into `user` (`Host`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Show_db_priv`, `Super_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Execute_priv`, `Repl_slave_priv`, `Repl_client_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Create_user_priv`, `Event_priv`, `Trigger_priv`, `Create_tablespace_priv`, `ssl_type`, `ssl_cipher`, `x509_issuer`, `x509_subject`, `max_questions`, `max_updates`, `max_connections`, `max_user_connections`, `plugin`, `authentication_string`, `password_expired`, `password_last_changed`, `password_lifetime`, `account_locked`) values('%','guest','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','','','','','','mysql_native_password','*11DB58B0DD02E290377535868405F11E4CBEFF58','N','2016-05-10 10:16:27',NULL,'N');
commit;
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO guest@'%' IDENTIFIED BY 'guest';
FLUSH PRIVILEGES;

这样就会有一个guest/guest的账号

20.  执行过程中请自己留意目录,哈哈哈 ,执行命令一般在mysql下的bin目录

centos6.6 下安装mysql5.7的更多相关文章

  1. centos6.7下安装mysql5.6.22同时解决中文乱码问题

    1.下载 http://dev.mysql.com/downloads/mysql/ 或者使用wget下载: wget http://dev.mysql.com/get/Downloads/MySQL ...

  2. CentOS6.8下安装MySQL5.6

    一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...

  3. centos6.4下安装mysql5.7.18

    1.安装前工作 在安装前需要确定现在这个系统有没有 mysql,如果有那么必须卸载(在 centos7 自带的是 mariaDb 数据库,所以第一步是卸载数据库). 卸载系统自带的Mariadb: 查 ...

  4. Centos6.6下安装MySQL5.6

    1.先查看本机上已经安装的MySQL rpm –qa | grep -i mysql 如果存在信息说明已经安装MySQL 需要完全卸载以前的MySQL yum remove mysql mysql-s ...

  5. Centos6.4下安装mysql5.6.10

    今天下午捣腾安装mysql和apache.从网上下载mysql5.6.10,http://ishare.iask.sina.com.cn/f/36050990.html,解压后发现没有configur ...

  6. CentOS6.4 下安装 MySql5.5.13

    1.卸载系统自带的MySql 1.1.查看该操作系统上是否已经安装了mysql数据库 [root@xhTest-1 ~]# rpm -qa | grep mysql 1.2.删除原mysql数据库 1 ...

  7. centos6.5 下安装mysql5.7

    http://blog.csdn.net/cryhelyxx/article/details/49757217 按步骤一路执行下去. 以下是补充: linux下,在mysql正常运行的情况下,输入my ...

  8. CentOS6.10下安装mysql-5.7.24

    卸载原有mysql 因为mysql数据库在Linux上实在是太流行了 所以目前下载的主流Linux系统版本基本上都集成了mysql数据库在里面 我们可以通过如下命令来查看我们的操作系统上是否已经安装了 ...

  9. 史上最简单的MySQL安装教程之Linux(CentOS6.8)下安装MySQL5.6

    一.准备 安装包:Percona-Server-5.6.21-70.0-r688-el6-x86_64-bundle.tar MySQL下载地址:http://www.percona.com/doc/ ...

随机推荐

  1. JS中的this机制

    1.this是啥? 简言之,this是JavaScript语言中定义的众多关键字之一,它的特殊在于它自动定义于每一个函数域内,但是this倒地指引啥东西却让很多人张二摸不着头脑.这里我们留个小悬念,希 ...

  2. leetcode921

    public class Solution { public int MinAddToMakeValid(string S) { Stack<char> ST = new Stack< ...

  3. spring data jpa、 hibernate、 jpa 三者之间的关系

    http://www.cnblogs.com/xiaoheike/p/5150553.html JPA规范与ORM框架之间的关系是怎样的呢? JPA规范本质上就是一种ORM规范,注意不是ORM框架-- ...

  4. ul li的添加 删除 复制 clone()

    语法总结 li=document.createElement('li') li.innerText = tag $('#i1').append(li) $(..).clone()  复制整个文本和Ht ...

  5. lua的注释

    和C语言一样,lua也有单行注释和多行注释之分 单行注释: 采用“--”来对注释后面的字符进行注释,类似于 ISO C90之后的 C语言的注释"//" 多行注释:采用"- ...

  6. proxmox 去除订阅提示

    去掉登陆时是否订阅通知修改文件   /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 搜索关键字  “You do not have ...

  7. sqlserver job 执行时间

    select instance_id,jh.run_date,jh.job_id,jh.step_name, case jh.run_status then 'failed' then 'Succee ...

  8. Qt's Undo Framework

    Overview of Qt's Undo Framework Introduction Qt's Undo Framework is an implementation of the Command ...

  9. webform版部分视图与请求拦截

    .主控前台页面 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFor ...

  10. xml数据改动

    public void reXml ( string namepngname ) { XmlDocument doc = new XmlDocument(); doc.Load(_xmlpath); ...