1. 下载安装包
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm(centos7)
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm(centos6)
2. 安装
rpm -ivh mysql57-community-release-el6-9.noarch.rpm;
yum install mysql-server
3. 启动mysql服务
systemctl start mysqld(centos7的启动命令)
service mysqld start(centos6的启动命令)
4. 查看临时密码
mysql启动时会生成一个临时密码:grep 'temporary password' /var/log/mysqld.log
5. 配置mysql安装项
mysql_secure_installation
根据提示可以选择y即可,密码强度可以自行选择,重新设置密码
6. 设置运行所有的主机都可以访问
进入mysql:
设置访问权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' with grant option;
FLUSH PRIVILEGES;
7. 配置3306访问端口或关闭防火墙
service iptables stop
日志存放路径: /var/log/mysqld.log
配置文件存放路径: /etc/my.cnf
可能遇到的问题:
1.使用yum 安装时出现 : Loaded plugins: fastestmirror
1.1 修改插件配置文件
[root@localhost yum.repos.d]# vim /etc/yum/pluginconf.d/fastestmirror.conf
enabled=0 //由 1 改成0 ,禁用该插件
1.2 修改yum 配置文件
[root@localhost yum.repos.d]# vim /etc/yum.conf
plugins=0 //不使用插件
2. 报错[Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)]
2.1 查看安装的mysql
yum list installed |grep mysql
2.2 删除安装的mysql
yum -y remove mysql57-community-release.noarch
2.3 重新下载mysql的rpm文件
wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
2.4 安装Mysql的yum源
rpm -ivh mysql57-community-release-el6-9.noarch.rpm;
2.5 安装mysql
yum install mysql-community-server