1.Mysql下载并上传:
下载官网:https://dev.mysql.com/downloads/mysql/
2.创建单独目录,并解压出安装包
mkdir mysql
tar -xvf mysql压缩包名.tar -C mysql
3.安装mysql安装包
rpm -ivh mysq1-community-comon-8.0.26-1.e17.x86 64.rpm
rpm -ivh mysql-community-client-plugins-8.0.26-1.e17.x86_ _64.rpm
rpm -ivh mysql-community-1ibs-8.0.26-1.e17.x86_ 64.rpm
rpm -ivh mysq1-community-libs-compat-8.0.26-1.e17.x86 64.xpm
rpm -ivh mysql-community-deve1-8.0.26-1.e17.x86 _64.rpm
rpm -ivh mysql-community-client-8.0.26-1.e17.x86 _64.rpm
rpm -ivh mysql-community-server-8.0.26-1.e17.x86 64.rpm
上述过程如何查询需要依赖,可使用yum install 具体依赖名,下载相关依赖;
4.启动MySQL服务
systemctl start mysqld
systemctl restart mysqld
systemctl stop mysqld
5.初次登录查看初始登录密码: 查看位置: /var/log/mysql.log
grep 'temporary password' /var/log/mysqld.log
登录命令:mysql -u root -p 初始密码
6.修改登录密码:命令: alter user 'root'@'localhost' identified by '新密码';
可选择设置密码底级以及位数
7.远程访问,创建远程服务用户
create user 'root'@'%' IDENTIFIED WITH mysql_native_password By '具体密码';
给root用户分配权限:
grant all on *.* 'root'@'%';
8.开启Linux的防火墙的MySQL端口