centos6.6 下安装mysql5.7
背景
没啥好说的,就是需要搭建自己的测试数据库跟研发的数据隔离开来,需要怼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的更多相关文章
- centos6.7下安装mysql5.6.22同时解决中文乱码问题
1.下载 http://dev.mysql.com/downloads/mysql/ 或者使用wget下载: wget http://dev.mysql.com/get/Downloads/MySQL ...
- CentOS6.8下安装MySQL5.6
一:卸载旧版本 使用下面的命令检查是否安装有MySQL Server rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm -e mysql //普通删除模式 rpm -e ...
- centos6.4下安装mysql5.7.18
1.安装前工作 在安装前需要确定现在这个系统有没有 mysql,如果有那么必须卸载(在 centos7 自带的是 mariaDb 数据库,所以第一步是卸载数据库). 卸载系统自带的Mariadb: 查 ...
- Centos6.6下安装MySQL5.6
1.先查看本机上已经安装的MySQL rpm –qa | grep -i mysql 如果存在信息说明已经安装MySQL 需要完全卸载以前的MySQL yum remove mysql mysql-s ...
- Centos6.4下安装mysql5.6.10
今天下午捣腾安装mysql和apache.从网上下载mysql5.6.10,http://ishare.iask.sina.com.cn/f/36050990.html,解压后发现没有configur ...
- CentOS6.4 下安装 MySql5.5.13
1.卸载系统自带的MySql 1.1.查看该操作系统上是否已经安装了mysql数据库 [root@xhTest-1 ~]# rpm -qa | grep mysql 1.2.删除原mysql数据库 1 ...
- centos6.5 下安装mysql5.7
http://blog.csdn.net/cryhelyxx/article/details/49757217 按步骤一路执行下去. 以下是补充: linux下,在mysql正常运行的情况下,输入my ...
- CentOS6.10下安装mysql-5.7.24
卸载原有mysql 因为mysql数据库在Linux上实在是太流行了 所以目前下载的主流Linux系统版本基本上都集成了mysql数据库在里面 我们可以通过如下命令来查看我们的操作系统上是否已经安装了 ...
- 史上最简单的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/ ...
随机推荐
- 机器学习中的python常用函数
glob模块 说明: 1.glob是python自己带的一个文件操作相关模块,用它可以查找符合自己目的的文件,就类似于Windows下的文件搜索, 支持通配符操作 *.?.[] 这三个通配符,*代表0 ...
- Docker系列05:docker镜像制作 &Docker file
1 什么是Dockerfile? Dockerfile是一个包含用于组合映像的命令的文本文档.可以使用在命令行中调用任何命令. Docker通过读取Dockerfile中的指令自动生成映像. dock ...
- Selenium Webdriver——Table类封装
WebTable.java import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebEl ...
- dsm winscp 获得 root 权限修改上传文件
使用DSM开了ssh只可以用admin登陆scp没有权限上传文件.可以用以下方法. ssh 登陆 dsm sudo -i 取得root权限 修改 /etc/sudoers 文件中 %administ ...
- ios 7.1企业证书无线安装
ios升级到7.1时,企业证书http服务器发布无线安装不能使用,需要使用https服务器. 测试了几种方式 1.测试时自签名https证书测试无效,提示不能连接到服务器 2.使用dropbox共享连 ...
- 两个链表的交叉 · Intersection of Two Linked Lists
[抄题]: Write a program to find the node at which the intersection of two singly linked lists begins. ...
- android4.2 高用zing拍照后,返回其它页面操作时,主线程关掉或程序退出的问题解决
产生错误的代码: @Override protected void onCreate(Bundle savedInstanceState) { StrictMode.setThreadPolicy(n ...
- radiobutton 选中的项不能去掉选择的问题
代码如下: RadioButton rbtn = new RadioButton(getApplicationContext()); rbtn.setText(String.valueOf(item. ...
- gradle使用总结
###打包时跳过单元测试
- centos7 redis伪集群安装
安装gcc: yum install gcc -y 上传redis软件包到 /home下 解压: tar xf redis-3.2.11.tar.gz 进入 redis 目录 : cd r ...