[root@rsync ~]# yum install libaio-devel -y #安装共享库
[root@rsync ~]# wget http://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
mv mysql-5.5.48-linux2.6-x86_64 /usr/local/mysql
useradd mysql -s /sbin/nologin -M
chown -R mysql.mysql /usr/local/mysql/data/
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"
原文地址:http://dingbusan.blog.51cto.com/5485009/1784247