在linux上安装mysql数据库

一、MySQL数据库的安装

1.MySQL数据库安装

  1. 通过secureCRT工具连接Linux系统

  2. 上传 mysql 的安装包

alt + p -------> put d:/setup/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
  1. 解压 mysql 的安装包
mkdir mysql
tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar -C mysql/
  1. 安装客户端
cd mysql/
rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm --force --nodeps
  1. 安装服务端
rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm --force --nodeps
  1. 修改mysql默认字符集
vi /etc/my.cnf

添加如下内容:
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci

-- 需要在最下方填写
[client]
default-character-set=utf8
  1. 启动mysql服务
service mysqld start
  1. 登录mysql
mysql -u root -p  敲回车,输入密码
初始密码查看:cat /var/log/mysqld.log
在root@localhost:   后面的就是初始密码
  1. 修改mysql登录密码
set global validate_password_policy=0;

set global validate_password_length=1;

set password=password('密码');
  1. 授予远程连接权限
//授权
grant all privileges on *.* to 'root' @'%' identified by '密码';
//刷新
flush privileges;
  1. 关闭Linux系统防火墙
systemctl stop firewalld.service

2.MySQL数据库登录

  • sqlyog工具登录mysql

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45417754/article/details/124233477