netnr/ install-mysql5.7.sh 2018-09-20 14:22
linux 安装 MySQL5.7
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum install mysql-server

mysqld --initialize # 初始化

chown mysql:mysql -R /var/lib/mysql # 设置权限

systemctl start mysqld  # 启动
service mysqld restart  # 重启
systemctl status mysqld # 状态

mysqladmin --version    # 验证
cat /etc/my.cnf # 配置
cat /var/log/mysqld.log # 日志

grep 'temporary password' /var/log/mysqld.log   # 查找临时密码

mysql -uroot -p'kYOob33wi2&u'   # 连接(临时密码)

alter user user() identified by "123";  # 设置密码

# 允许远程访问
use mysql;
select host,user from user;
UPDATE user SET Host='%' WHERE User='root' AND Host='localhost' LIMIT 1;
flush privileges;

#help
http://www.runoob.com/mysql/mysql-install.html


# RPM 包安装方式
# 按照以下顺序进行安装,因为它们之间存在依赖关系
# common --> libs --> clients --> server
# 下载 mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar 或者分别下载