centos 安装mysql 5.6 二进制包安装

前端之家收集整理的这篇文章主要介绍了centos 安装mysql 5.6 二进制包安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1 下载MysqL

https://cdn.MysqL.com//Downloads/MysqL-5.6/MysqL-5.6.37-linux-glibc2.12-x86_64.tar.gz

我下载的是MysqL 5.6

2.解压它移动到对应目录下

tar -zxvf MysqL-5.6.37-linux-glibc2.12-x86_64.tar.gz

cp ./MysqL-5.6.37-linux-glibc2.12-x86_64 /usr/local/MysqL

创建用户和组

groupadd MysqL和useradd -r -g MysqL mysq

进入源码目录

cd /usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64

创建data目录存放MysqL 数据

mkdir data

修改目录的用户和组

chown -R MysqL:MysqL .

复制这个文件到init.d目录下

加入开机自启动项

cp support-files/MysqL.server /etc/init.d/MysqLd

vi /etc/init.d/MysqLd

basedir=/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64

datadir=/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64/data

初始化MysqL

./scripts/MysqL_install_db --use=MysqL --basedir=/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64

--datadir=/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64/data

--defaults-file=/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64/my.cnf

加入开机自启动项

chkconfig --add MysqLd

chkconfig --list MysqLd

启动MysqL 服务

service MysqLd start

查看是否启动成功

netstat -anp|grep MysqLd

进入MysqL

./bin/MysqL -u root


/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64/bin/MysqLadmin -u root password 'new-password'

/usr/local/MysqL/MysqL-5.6.37-linux-glibc2.12-x86_64/bin/MysqLadmin -u root -h skinglzw password 'new-password'

猜你在找的CentOS相关文章