yum -y install curl telnet vim wget lrzsz net-tools
修改vim配置(可以不修改,按照默认的即可,这里仅仅是偏好)
1 2 3 4 5 6 7 8 9 10
vim ~/.vimrc set encoding=utf-8 " 文件编码 set number " 显示行号 set tabstop=4 " tab宽度为4 set softtabstop=4 " 设置一次可以删除4个空格 set expandtab " tab转换为空格 set nowrap " 不自动换行 set showmatch " 显示括号配对情 syntax on " 开启语法高亮
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # #
[base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# 检查mysql用户组和用户是否存在,如果没有,则创建 cat /etc/group | grep mysql cat /etc/passwd | grep mysql # 创建 mysql 组 groupadd mysql # 新建 mysql 用户并加入 mysql 群组 useradd -r -g mysql mysql
# 登录 MySQL,密码使用初始化成功时 root@localhost: 后的字符串 mysql -u root -p
# 修改密码 毕竟那么不好记 # 而且如果不修改 它会报 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. 的错误 alter user root@'localhost' identified by 'newpassword'; flush privileges;
# 开放远程连接 use mysql; # ① MySQL 8.0 之前的版本,password 为自己设置的密码 grant all privileges on *.* to 'root'@'%' identified by 'password';
# ② 适用于 MySQL 8.0 之后的版本,推荐先创建一个用户 dev,再进行授权 # 直接授权给 root # grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option; create user dev@'%' identified by '123456'; grant select,update,delete,insert on *.* to dev@'%' with grant option;