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'@”%”;
标签:Linux,root,44,mysql5.6,server,usr,mysql,my,local 来源: https://blog.csdn.net/F15217283411/article/details/117652069