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
复制这个文件到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'