1.准备安装文件
MySQL安装文件 MySQL Community Server 5.7.27
2.开始安装
cd /opt
mkdir mysql
tar xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
# centos 6 or 7
sudo yum install mysql-community-{client,common,libs}-*
3.启动mysql
# 启动mysql
sudo service mysqld start
4.测试
# 查看密码
sudo grep 'temporary password' /var/log/mysqld.log
# 连接mysql
mysql -uroot -p
# 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
5.创建用户授权
# 授权test_user 允许远程操作 test 库
grant all privileges on test.* to 'test_user'@'%';
# 刷入权限
privileges flush;
6.端口开放
参考Linux/Centos firewalled开放端口
网友评论