CentOS7.5二进制安装MySQL-5.6.40
2024-08-25 02:50:01
安装依赖
yum install -y gcc gcc-c++ automake autoconf
yum -y install cmake bison-devel ncurses-devel libaio-devel
mysql-5.6.40二进制包下载地址
https://downloads.mysql.com/archives/get/file/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
1.下载MySQL-5.6.40二进制包
[root@7-test1 ~]# wget https://downloads.mysql.com/archives/get/file/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
2.解压缩mysql二进制包到/usr/local
[root@7-test1 ~]# tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -C /usr/local
3.修改名称、做软连接
[root@7-test1 ~]# cd /usr/local
[root@7-test1 local]# mv mysql-5.6.40-linux-glibc2.12-x86_64 mysql-5.6.40
[root@7-test1 local]# ln -s mysql-5.6.40 mysql
4.创建mysql用户和组
//创建mysql组
[root@7-test1 local]# groupadd mysql
//创建mysql用户
[root@7-test1 local]# useradd -g mysql -s /bin/false mysql
5.拷贝主配置文件
//备份/etc/my.cnf
[root@7-test1 local]# mv /etc/my.cnf /etc/my.cnf.old
//拷贝主配置文件
[root@7-test1 ~]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
6.拷贝启动脚本
[root@7-test1 ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
7.初始化mysql
//进入/usr/local/mysql/scripts
[root@7-test1 ~]# cd /usr/local/mysql/scripts
//初始化前安装依赖包
[root@test1 scripts]# yum -y install autoconf
//初始化mysql
[root@7-test1 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
--user #指定mysql用户
--basedir #指定mysql安装目录
--datadir #指定mysql数据目录
初始化报错
[root@7-test1 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper
原因:缺少autoconf依赖包
解决方法
[root@7-test1 scripts]# yum -y install autoconf
8.添加mysql命令环境变量
//导出mysql命令环境变量
[root@7-test1 scripts]# echo "export PATH=/usr/local/mysql/bin:$PATH" > /etc/profile.d/mysql.sh
//使配置生效
[root@7-test1 scripts]# source /etc/profile
9.配置systemd管理mysql
[root@7-test1 scripts]# vim /etc/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
10.启动mysql、检查启动
//启动mysql
[root@7-test1 scripts]# systemctl start mysqld ; systemctl enable mysqld
[root@7-test1 scripts]# netstat -ntpl | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 31349/mysqld
11.进入mysql并设置密码
//设置mysql密码
mysql> set password=password('123');
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
最新文章
- C#设计模式-访问者模式
- 十大广泛使用的Linux发行版
- lftp使用普通ftp模式登录
- 为什么高手离不了Linux系统?这就是我的理由
- C#常用函数--通用篇
- docker operation method note
- SPOJ 416 Divisibility by 15 细节题
- How to run OFBiz as a Service on linux
- jQuery事件函数bind,live,delegate的区别
- uva 10192 Vacation(最长公共子)
- C#入门经典(第五章-1)
- Spring Mybatis-分页插件使用
- 8.2 GOF设计模式一: 单实例模式 SingleTon
- 洛谷P1119灾后重建
- [转]Twemproxy 介绍与使用
- (面试)写出下面switch语句的输出结果
- RALL资源获取初始化,删除器
- nginx添加新模块
- Windows 64位系统下安装JAVA环境
- 新人学PHP,认为手动搭建环境而苦恼吗?这篇文章告诉你多简单!
热门文章
- 07_Redis事务
- day14 HTML CSS
- android测试Code
- ORACLE 角色授权
- Java学习笔记——关于位运算符的问题
- 【Leetcode】【Medium】Construct Binary Tree from Preorder and Inorder Traversal
- js笔记 标签: javascript 2016-08-01 13:30 75人阅读 评论(0) 收藏
- 重新认识KCP
- 常规渗透:没遇到过的anquan狗
- jsp和servlet的问题收集.... 答案有部分是自己理解的,可能有点差异