说明:

mysql安装在/data/mysql-5.6.35目录下;

如果安装在/usr/local/mysql/目录下,则两个sed不许执行,因为默认是/usr/local/目录下;

1.下载

cd /data/

tar -zxf  mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.6.35-linux-glibc2.5-x86_64 /data/mysql-5.6.35

2.新建mysql用户及设置权限

sudo useradd -s /sbin/nologin -M mysql

mkdir -pv  /data/mysql-5.6.35/{var,log}

touch /data/mysql-5.6.35/log/error.log

sudo chown -R mysql:mysql /data/mysql-5.6.35/

3.添加环境变量:

vim ~/.bash_profile

export PATH=/data/mysql-5.6.35/bin:$PATH

source ~/.bash_profile

4.初始化数据库,修改默认路径

cd /data/mysql-5.6.35/

sudo ./scripts/mysql_install_db --basedir=/data/mysql-5.6.35/ --datadir=/data/mysql-5.6.35/data/ --user=mysql

sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/bin/mysqld_safe

sudo sed -i 's#/usr/local/mysql#/data/mysql-5.6.35#g' /data/mysql-5.6.35/support-files/mysql.server

sudo ln -s /data/mysql-5.6.35/bin/mysql /usr/bin

5.修改配置文件

sudo rm –f /etc/my.cnf

sudo vim /data/mysql-5.6.35/my.cnf

[client]

port       = 3306

socket   = /tmp/mysql.sock

[mysqld]

server-id  = 1

port      = 3306

basedir = /data/mysql-5.6.35

datadir  = /data/mysql-5.6.35/data

socket  = /tmp/mysql.sock

binlog-ignore-db  = mysql

log-bin  = /data/mysql-5.6.35/log/mysql-bin

innodb_file_per_table = 1

open_files_limit  = 65535

sql_mode  =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

skip-host-cache

skip-name-resolve

max_connections  = 1024

wait_timeout  = 31536000

interactive_timeout = 31536000

character-set-server  =utf8mb4

collation-server  = utf8mb4_general_ci

init_connect  = 'SET NAMES utf8mb4'

lower_case_table_names = 1

log_error  = /data/mysql-5.6.35/log/error.log

slow_query_log = 1

slow_query_log_file = /data/mysql-5.6.35/log/slow.log

[mysqld_safe]

err-log= /data/mysql-5.6.35/log/mysqld_safe_err.log

pid-file = /data/mysql-5.6.35/var/mysqld.pid

6.将服务脚本复制到/etc/init.d目录下,并添加到服务列表

sudo cp  support-files/mysql.server  /etc/init.d/mysqld

7.开机自启动

sudo chkconfig --add mysqld

sudo chkconfig mysqld on

sudo chkconfig --list mysqld

8.启动mysql

sudo  /etc/init.d/mysqld start

ps –ef | grepmysql

9.设置mysql密码

sudo /data/mysql-5.6.35/bin/mysqladmin -u root password 'newpassword'

10.登录

mysql  -uroot   -p

11.配置安全策略:

[root@KVM mysql-5.6.35]#sudo /data/mysql-5.6.35/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current

password for the root user.  Ifyou've just installed MySQL, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n

... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them.  This is intended only fortesting, and to make the installation

go a bit smoother.  You shouldremove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]n

... Success!

By default, MySQL comes with a database named 'test' that anyone can

access.  This is also intended only fortesting, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

- Dropping test database...

... Success!

- Removing privileges on testdatabase...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y

... Success!

All done!  If you've completed allof the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

[root@KVM mysql-5.6.35]#

本文转自898009427 51CTO博客,原文链接:http://blog.51cto.com/moerjinrong/1929288,如需转载请自行联系原作者

mysql5.6.35安装_mysql5.6.35 二进制快速安装相关推荐

  1. mysql5.7.10安装_MySQL5.7.10下载及安装及配置-阿里云开发者社区

    MySQL5.7.10下载及安装及配置 一.下载 自MySQL版本升级到5.7以后,其安装及配置过程和原来版本发生了很大的变化,下面详细介绍5.7版本MySQL的下载.安装及配置过程. 图1.1 My ...

  2. mysql5.6.27安装_mysql-5.6.27源码安装及错误解决办法

    环境:centos6.5.x86_64yum install -y cmake  当然也可以自己下载源码包安装,为方便就Yum安装了 useradd -s /sbin/nologin mysql ta ...

  3. 安装mysql 没有快捷_快速安装mysql

    一.快速安装mysql准备工作 首先需要保证自己的开发工具包已安装:未安装使用 yum  groupinstall  'Develop Tools '  -y 这样就不会出现缺少gcc和  No cu ...

  4. redhat linux 7 安装,Redhat Linux 7.3 快速安装指引 *

    教你快速安装 Redhat Linux 7.3- 特点及功能如下 使用单纯的结构,以提供主流服务,系统将不安装 X-Window 接口. 具备 ProFtp.Sendmail.Webmail.web ...

  5. 破解长虹电视不能安装u盘app,快速安装第三方软件

    众多长虹电视在安装U盘软件时,会出现下图提示.网上很多文章说要刷固件降级才行,其实不然.本文以"蚂蚁市场"这个软件为例,告诉大家破解长虹电视不能安装u盘app的方法,快速安装第三方 ...

  6. zabbix安装 (zabbix在docker下快速安装教程)

    1, centos 安装docker 查看centos版本:cat /etc/redhat-release 安装 :yum install docker-latest 启动服务 :systemctl ...

  7. linux mysql5.7.18多实例_mysql5.7.13二进制包安装多实例

    mysql最新版本:5.7.13 操作系统:centos6.5 ####################################################### 首先查看系统有无已安装m ...

  8. mysql5.5.8编译安装_MySQL5.5.8源代码编译安装

    /*安装CMake*//*进入CMake源代码所在目录*/cd #/*解压CMake源代码*/tar zxf cmake-2.8.3.tar.gz /*进入CMake源代码目录*/cd cmak 首页 ...

  9. mysql5.6.28安装_mysql5.6.28源码安装

    众所周知,mysql5.5版本之前都是通过./configure进行编译环境检查,mysql5.5之后用的是cmake(包括5.5) 安装前的准备工作: [root@localhost ~]#wget ...

最新文章

  1. mysql开启慢查询
  2. 简述驱动桥的动力传递路线_卡车驱动桥中的差速锁究竟有多大的作用?它是如何起作用的?...
  3. 全球最大的免费暗网托管服务商 DH 再度被黑关闭
  4. win10双网卡冗余的几种方法
  5. javaaop模式供其他项目调用_结构性模型-静态代理模式
  6. java平均的随机数_Java 随机数详解
  7. java 解析中文乱码_解析Java中文乱码的处理方法
  8. python爬虫-基础入门-python爬虫突破封锁
  9. 模型转换、压缩、加速工具
  10. 《沟通的方法》笔记十:激励
  11. JVM-13. 垃圾回收器
  12. html3d电子相册,3d电子相册制作软件
  13. 【LabVIEW懒人系列教程-小白入门】1.13LabVIEW程序结构之事件结构
  14. 解决最新版 mac os sierra usb网卡不能使用的问题
  15. 90 个名企笔试题和算法题
  16. Vue 之 解决v-html生成的元素不能触发@click等vue事件和CSS样式不生效的方法
  17. 血糖仪等蓝牙设备SDK
  18. Trackingthe whole worlds carbon emissions - with satellites and AI
  19. 试讲教案模板 计算机 网络,试讲教案模板,网络技术.doc
  20. 饼状图(PieChart)与柱形图(BarChart)的使用

热门文章

  1. 前端页面:一直报Cannot set property 'height' of undefined
  2. 前端路由的两种实现原理
  3. AI造福设计师:搭配色板这种苦差事交给GAN就好啦(教程)
  4. 300GB*6 SCSI RAID5 LINUX服务器数据恢复手记
  5. Maven的Settings.xml配置文件解释
  6. secureFX上传文件的时候报错,secureFX崩溃
  7. CFD分析过程(CFD Analysis Process)
  8. vs设计窗口不见了_碳纤维的巅峰:VS沛纳海616V3
  9. html写用户导入,用户基本信息录入.html
  10. python爬去中国天气网_python爬取中国天气网并展示最低温度