#1 安装依赖包
yum -y install perl perl-devel
#2 新建用户组合用户
1groupadd mysql 2useradd mysql -g mysql
#3 解压到data下面
1mkdir /data 2tar -zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz -C /data
#4 重命名
1cd /data 2mv mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz mysql
#5 安装
cd/data/mysql
初始化安装
/data/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data
出现以下报错解决方法:
1WARNING: The host 'MySQL' could not be looked up with /data/mysql/bin/resolveip. 2This probably means that your libc libraries are not 100 % compatible 3with this binary MySQL version. The MySQL daemon, mysqld, should work 4normally with the exception that host name resolving will not work. 5This means that you should use IP addresses instead of hostnames 6when specifying MySQL privileges ! 7Installing MySQL system tables.../data/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
添加IP对应的主机名
vim /etc/hosts
以及安装依赖关系libaia文件
yum install libaio* -y
#6 更改所有者
1su root 2chown -R mysql:mysql /data/mysql 3cd /data/mysql/support-files/ 4cp my-default.cnf /etc/my.cnf 5cp mysql.server /etc/init.d/mysqld
#7 设置环境变量
1echo 'PATH=/data/mysql/bin/:$PATH' >>/etc/profile 2source /etc/profile
#8 添加用户并授权 修改root本地登陆密码
1set password=PASSWORD(‘vv@122’); 2grant all privileges on *.* to ‘vv’@'%' identified by 'vv@122'; 3flush privileges;
#9设置开机自启动
chkconfig --add mysqld