1 安装依赖包
yum -y install perl perl-devel
2 新建用户组合用户
groupadd mysqluseradd mysql -g mysql
3 解压到data下面
mkdir /datatar -zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz -C /data
4 重命名
cd /datamv 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
出现以下报错解决方法:
WARNING: The host 'MySQL' could not be looked up with /data/mysql/bin/resolveip.This probably means that your libc libraries are not 100 % compatiblewith this binary MySQL version. The MySQL daemon, mysqld, should worknormally with the exception that host name resolving will not work.This means that you should use IP addresses instead of hostnameswhen specifying MySQL privileges !Installing 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 更改所有者
su rootchown -R mysql:mysql /data/mysqlcd /data/mysql/support-files/cp my-default.cnf /etc/my.cnfcp mysql.server /etc/init.d/mysqld
7 设置环境变量
echo 'PATH=/data/mysql/bin/:$PATH' >>/etc/profilesource /etc/profile
8 添加用户并授权
修改root本地登陆密码
set password=PASSWORD(‘vv@122’);grant all privileges on *.* to ‘vv’@'%' identified by 'vv@122';flush privileges;
9设置开机自启动
chkconfig --add mysqld