安装步骤:
1. 查看CentOS自带MySQL 5.1组件并卸载。
rpm -qa | grep -i mysql
rpm -e --nodeps mysql-libs-5.1.61-4.el6.x86_64 等
cd /var/lib/mysql
rm -rf * 删除原先配置
检查依赖包 rpm -qa | grep -i numactl
2. 安装MySQL(下面的安装顺序不能错,否则会安装失败)
rpm -ivh mysql-community-common-5.7.11-1.el6.i686.rpm
rpm -ivh mysql-community-libs-5.7.11-1.el6.i686.rpm
rpm -ivh mysql-community-client-5.7.11-1.el6.i686.rpm
rpm -ivh mysql-community-server-5.7.11-1.el6.i686.rpm
3. 启动MySQL service mysqld start
获得MySQL初始密码
grep 'temporary password' /var/log/mysqld.log
2016-02-22T10:46:50.930703Z 1 [Note] A temporary password is generated for root@localhost: iwrg=PsNO86Y使用上一步获得的密码登录MySQL,并修改初始密码
mysql -uroot -p'初始密码'
alter user 'root'@'localhost' identified by 'UYmi@191';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ' password' WITH GRANT OPTION;
flush privileges
;mysql -h ipaddress-uroot -p'password'
以上,MySQL 5.7.11安装完成。且能远程访问。一般简单到此安装结束。
1.之后还可以放开防火墙、设定自启动、增强MySQL安全设置等。
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
2./etc/init.d/iptables save
3.chkconfig mysqld on
4.mysql_secure_installation