1、安装依赖包
yum -y install perl perl-devel autoconf libaio
2、下载mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
3、解压
tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /application/mysql
4、添加用户组
groupadd mysql
添加用户mysql 到用户组mysql
useradd -g mysql mysql
5、安装
mkdir -p /application/mysql/data/mysql
chown -R mysql:mysql /application/mysql/
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/mysql
6、配置
cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
7、修改配置
#修改启动脚本
cat /etc/init.d/mysqld
[mysqld]
basedir=/application/mysql/
datadir=/application/mysql/data/mysql
bind-address = 192.168.10.10
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
8、启动服务
#启动mysql
service mysqld start
#关闭mysql
service mysqld stop
#查看运行状态
service mysqld status
9、加入环境变量,编辑
# 这样可以在任何地方用mysql命令了
vi /etc/profile
export PATH=$PATH:/application/mysql/bin
source /etc/profile
10、测试连接
# 修改密码
mysql_secure_installation
# 登录验证
mysql -uroot -p