Linux安装mysql5.6.44

1.准备资源
虚拟机环境:VMware Workstation Pro、Centos7
官网下载mysql5.6.44:
点击下载

2.上传资源
第一步:上传软件包到linux操作系统,推荐使用xftp7
第二步:对mysql压缩包进行解压操作:tar.gz

# tar –zxf mysql-5.6.44-linux-glibc2.12-x86_64.tar.gz

第三步:移动mysql文件夹到/usr/local目录下并更名为mysql

# mv mysql-5.6.44-linux-glibc2.12-x86_64.tar /usr/local/mysql

3.安全设置
创建一个mysql用户并更改/usr/local/mysql目录权限(用户和组)

# useradd –r –s /sbin/nologin mysql

4.初始化数据库

[root@localhost /usr/local/mysql/] # scripts/mysql_install_db --user=mysql

初始化之前需要安装autoconf库【命令:yum-y install autoconf

5.移除mariadb-libs库文件

[root@localhost /usr/local/mysql/] # yum remove mariadb-libs

6.移动support-files目录下的mysql.server脚本到/etc/init.d目录一份=>service

[root@localhost /usr/local/mysql/] # cp support-files/mysql.server /etc/init.d/mysql

7.启动mysql脚本

# service mysql start

8.设置密码并测试mysql数据库

# bin/mysqladmin -u root password 'root';
# bin/mysql -uroot -p 
Enter Password:root

9.mysql远程连接Navicate

授予其他用户访问权限:

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

10.配置my.conf配置,将/usr/local/mysql/support-files路径下的my-default.cnf复制到/etc/路径下并改名为my.cnf

在这里插入图片描述

# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

my.cnf简易配置:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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 = 3306
#socket = /usr/local/mysql/mysql.sock
[mysql]
default-character-set=utf8


[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# 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 = /usr/local/mysql/
 datadir = /usr/local/mysql/data/
 port = 3306
 character-set-server=utf8
# server_id = .....
# socket = /usr/local/mysql/mysql.sock.

# 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 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

如果其中的#注释没有显示颜色效果,授予my.cnf具有644权限

# chmod 644 /etc/my.cnf 

其他操作:
拒绝远程连接:
回收权限:

Mysql>revoke all privileges,grant option from 'root'@”%;
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嗝屁小孩纸

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值