1通过SSH工具连接Linux系统
2上传 mysql 的安装包
3解压 mysql 的安装包
mkdir mysql
tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar -C mysql/
4安装客户端
cd mysql/
rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm --force --nodeps
5安装服务端
rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm --force --nodeps
6修改mysql默认字符集
vi /etc/my.cnf
添加如下内容:
[mysqld] character-set-server=utf8 collation-server=utf8_general_ci
在文件最下方添加
[client] default-character-set=utf8
7启动mysql服务
service mysqld start
8登录mysql
mysql -u root -p 敲回车,输入密码
初始密码查看:
cat /var/log/mysqld.log
在root@localhost: 后面的就是初始密码
9修改mysql登录密码
set global validate_password_policy=0;
set global validate_password_length=1;
set password=password('密码');
10授予远程连接权限
//授权
grant all privileges on *.* to 'root' @'%' identified by '密码';
//刷新
flush privileges;
11关闭Linux系统防火墙
systemctl stop firewalld
12重启mysql服务
service mysqld restart