1、官网或镜像下载
mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
2、安装依赖
yum install -y perl-Module-Install.noarch
3、加帐号与分组
#加帐号
userdel mysql
useradd -s /sbin/nologin mysql
#加分组
groupdel mysql
groupadd mysql
useradd -r -g mysql mysql
4、解压
#解压并移动到目标位置
rm -rf mysql-5.6.34-linux-glibc2.5-x86_64
rm -rf mysql-5.6.34-linux-glibc2.5-x86_64?
rm -rf /etc/init.d/mysql
rm -rf /etc/init.d/mysql?
rm -rf /usr/local/mysql
tar -zxvf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.34-linux-glibc2.5-x86_64 /usr/local/mysql
5、目录授权
#授权
chown -R mysql:mysql /usr/local/mysql
6、创建数据库
#创建数据库实例
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
7、设置开机启动
#开机启动
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
8、数据库配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
9、 编辑 /etc/my.cnf 改端口,改数据目录,日志目录等
vim /etc/my.cnf
10、编辑 iptabls
echo " 开通 3066 端口"
vim /etc/sysconfig/iptables
11、启动
service iptables restart
service mysql restart
12、改密码(此版本,本机登录无需密码)
/usr/local/mysql/bin/mysql -u root
#修改本机
grant all on *.* to 'root'@'localhost' IDENTIFIED BY 'newpwd' with grant option ;
flush privileges;
#修改远程
grant all on *.* to 'root'@'192.168.1.%' IDENTIFIED BY 'newpwd' with grant option ;
flush privileges;
13、用 navicat for mysql 登录