服务器信息:
服务器:阿里云
系统:CentOS7.3
MySQL:5.7.18
安装过程
更新yum源: yum update
下载MySQL源安装包:
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装MySQL源:yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查MySQL源安装情况: yum repolist enabled | grep "mysql.*-community.*"
安装MySQL: yum install mysql-community-server
启动MySQL: systemctl start mysqld
查看MySQL状态: systemctl status mysqld
设置开机启动MySQL:
systemctl enable mysqld
systemctl daemon-reload
查找并修改MySQL默认密码:
grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
alter userroot@localhost identified by '你的新密码';
远程连接测试
添加远程账户:
GRANT ALL PRIVILEGES ON *.* TO '用户'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
立即生效:flush privileges;
退出MySQL:exit
注意问题
1、本文使用root权限,普通用户需给sudo权限,到配置文件/etc/sudoers里配置
2、安装过程中出现选择的都按y然后回车允许
3、远程连接测试时候,注意在阿里云管理控制台的安全组里配置规则,授权3306端口允许访问