Centos7 MYSQL5.6.42二进制安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7 MYSQL5.6.42二进制安装相关的知识,希望对你有一定的参考价值。
1. 下载二进制mysql的安装包
[[email protected] ~]#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz
2. 新建一个专放软件的目录
[[email protected] ~]#mkdir -p /services/current_apps
3. 解压包到放软件的目录下
[[email protected] ~]# tar -xzf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz -C /services/current_apps
4. 进入目录
[[email protected] ~]# cd /services/current_apps/mysql-5.6.42-linux-glibc2.12-x86_6
5. 拷贝服务的模板文件
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld
6. 拷贝my.cnf配置模板
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# cp support-files/my-default.cnf /etc/my.cnf
7. 修改两个参数,稍后用作数据目录和mysql安装目录
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# vi /etc/init.d/mysqld
#If you change base dir, you must also change datadir. These may get
overwritten by settings in the MySQL configuration files.
basedir=/usr/local/mysql
datadir=/data/mysql
8. 新建上面的mysql数据目录
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# mkdir /data
9. 软连接mysql安装目录
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# ln -s /services/current_apps/mysql-5.6.42-linux-glibc2.12-x86_64/ /usr/local/mysql
10. 初始化mysql的数据目录
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
11. 把mysqld服务加入服务启动
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# chkconfig --add mysqld
12.启动mysqld 服务,显示success表示成功
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# service mysqld start
Starting MySQL.Logging to ‘/data/mysql/minion-1.err‘.
... SUCCESS!
13 确认服务mysql的确开启,返回1说明开了
[[email protected] mysql-5.6.42-linux-glibc2.12-x86_64]# netstat -tupln|grep 3306|wc -l
1
以上是关于Centos7 MYSQL5.6.42二进制安装的主要内容,如果未能解决你的问题,请参考以下文章