[root@rsync ~]# yum install libaio-devel -y #安装共享库
[root@rsync ~]# wgethttp://mirrors.sohu.com/mysql/My... ux2.6-x86_64.tar.gz#下载MysqL二进制包
[root@rsync ~]# tar xf MysqL-5.5.48-linux2.6-x86_64.tar.gz#解压二进制包
[root@rsync ~]# mv MysqL-5.5.48-linux2.6-x86_64 /usr/local/MysqL#将二进制包移动到安装目录
[root@rsync ~]# useradd MysqL -s /sbin/nologin -M#新建MysqL用户
[root@rsync ~]# chown -R MysqL.MysqL /usr/local/MysqL/data/#授权MysqL用户属主
初始化MysqL
[root@rsync ~]# cd /usr/local/MysqL
[root@rsync MysqL]# ./scripts/MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL --datadir=/usr/local/MysqL/data/
[root@rsync MysqL]# \cp /usr/local/MysqL/support-files/my-small.cnf /etc/my.cnf#拷贝MysqL配置文件
[root@rsync MysqL]# cp /usr/local/MysqL/support-files/MysqL.server /etc/init.d/MysqLd#拷贝MysqL启动文件
[root@rsync MysqL]# /etc/init.d/MysqLd start#启动MysqL
[root@rsync MysqL]#chkconfig MysqLd on #设置开机启动
[root@rsync MysqL]#vi /etc/profile.d/MysqL.sh#设置MysqL环境变量。添加如下内容
export PATH=$PATH:/usr/local/MysqL/bin
[root@rsync MysqL]#source /etc/profile.d/MysqL.sh#执行命令使用其生效
[root@rsync MysqL]# /usr/lcoal/MysqL/bin/MysqL_secure_installation #安全配置向导
[root@rsync MysqL]# netstat -lntup|grep MysqL
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1545/MysqLd
[root@rsync MysqL]# MysqL-uroot -p #登录MysqL
点击下面的复制代码,粘贴至命令行执行即可。
yum install libaio-devel wget -y
wget http://mirrors.sohu.com/MysqL/MysqL-5.5/MysqL-5.5.48-linux2.6-x86_64.tar.gz
tar xf MysqL-5.5.48-linux2.6-x86_64.tar.gz
useradd MysqL -s /sbin/nologin -M
cd /usr/local/MysqL
./scripts/MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL --datadir=/usr/local/MysqL/data/
\cp /usr/local/MysqL/support-files/my-small.cnf /etc/my.cnf
cp /usr/local/MysqL/support-files/MysqL.server /etc/init.d/MysqLd
cp -a /usr/local/MysqL/bin/* /usr/local/sbin/
chmod +x /etc/init.d/MysqLd
/etc/init.d/MysqLd start
chkconfig MysqLd on
MysqLadmin -uroot password "AbC123456"
MysqL -uroot -p"AbC123456"