CentOS7.5二进制安装MySQL-5.6.40
安装依赖
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)
原文地址:https://www.cnblogs.com/zeq912/p/10188972.html
相关推荐
-
千万并发不是梦:TCPBurn并发测试 服务器
2020-6-9
-
Apache HTTP Server 后门开发 服务器
2019-2-1
-
MySQL表结构的优化和设计 服务器
2019-7-22
-
除了负载均衡,Nginx还可以做很多,限流、缓存、黑白名单等 服务器
2020-6-10
-
一次页面请求过程 服务器
2019-3-14
-
Linux SSH密码暴力破解技术及***实战 服务器
2019-9-11
-
Linux,Mac下MySQL的安装及一些知识点的整理 服务器
2020-6-11
-
在 Linux 中不使用 useradd 命令如何创建用户账号 服务器
2019-8-17
-
跟面试官侃半小时MySQL事务隔离性,从基本概念深入到实现 服务器
2020-7-4
-
Hadoop集群中DataNode启动不了问题处理 服务器
2020-6-22