首页 > 数据库 >安装 MySQL 数据库

安装 MySQL 数据库

时间:2023-05-15 14:24:50浏览次数:48  
标签:安装 数据库 MySQL qfedu yum mysql root com

1、默认 yum 存储库安装 [[email protected] ~]# yum -y install wget     # 安装 wget下载工具 [[email protected] ~]# wget https://repo.mysql.com/mysql57-community-release-el7- 11.noarch.rpm # 下载 mysql 官方 yum 源安装包 [[email protected] ~]# yum -y localinstall mysql57-community-release-el7- 11.noarch.rpm # 安装 mysql 官方 yum 源 2、选择指定发行版本安装 使用 MySQL Yum 存储库时,默认情况下会选择要安装的最新GA版本MySQL。默认启用最新GA 系列(当前为MySQL 8.0)的子存储库,而所有其他系列(例如,MySQL 5.7系列)的子存储库均 被禁用。查看已启用或禁用了存储库。 1、列出所有版本 [[email protected] ~]# yum repolist all | grep mysql 发现启用最新8.0版本是 enabled 的,5.7版本是 disabled 的,需要安装5.7版本时,所以把8.0的 进行禁用,然后再启用5.7版本 2、安装 yum 配置工具 [[email protected] ~]# yum -y install yum-utils 3、禁用 8.0 版本 [[email protected] ~]# yum-config-manager --disable mysql80-community 4、启用 5.7 版本 [[email protected] ~]# yum-config-manager --enable mysql57-community 5、检查启用版本 [[email protected] ~]# yum repolist enabled | grep mysql 2、安装 MySQL 需要安装MySQL Server, MySQL client 已经包括在 server 套件内 [[email protected] ~]# yum -y install mysql-community-server mysql     # 安装服务 端,客户端 [[email protected] ~]# systemctl start mysqld # 启动 mysql 服务 [[email protected] ~]# systemctl enable mysqld             # 设置 mysql 服务开机启动 [[email protected] ~]# ls /var/lib/mysql           # 查看 mysql 安装 [[email protected] ~]# grep 'tqfeduorary password' /var/log/mysqld.log # 获取首次登 录密码 [[email protected] ~]# mysql -uroot -p'awm3>!QFl6zR'         # 登录mysql 数据库 mysql > alter user 'root'@'localhost' identified by 'Qf.123com';     # 修改 mysql 数据库密码(密码必须符合复杂性要求,包含字母大小写,数字,特赦符号,长度不少于8位) [[email protected] ~]# mysql -uroot -p'Qf.123com'                       # 用新密码登 录数据库 3、重启 MySQL [[email protected] ~]# systemctl restart mysqld 4、创建 qfedu 库并设置权限 [[email protected] ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>CREATE DATABASE qfedudb CHARACTER SET utf8 COLLATE utf8_bin; Query OK, 1 row affected (0.00 sec) mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on qfedudb.* TO 'qfedu'@'localhost' IDENTIFIED BY 'Yangge.123com'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> SHOW GRANTS FOR 'qfedu'@'localhost'; +------------------------------------------------------------------------------- ------------------------------+ | Grants for qfedu@localhost                                                                                   | +------------------------------------------------------------------------------- ------------------------------+ 千锋教育云计算学院三、结构化查询语言 SQL 结构化查询语言(Structured Query Language),简称SQL,是数据库的标准查询语言。可以通过 DBMS对数据库进行定义数据,操纵数据,查询数据,数据控制等 1、数据定义语言 (DDL) Data Dafifinitaon Language 如创建表 create 删除表 drop 修改表 alter 清空表 truncate,彻底清空,无法找回 | GRANT USAGE ON *.* TO 'qfedu'@'localhost' IDENTIFIED BY PASSWORD '*841E9705B9F4BD3195B7314CA58A7E3B3B349F71' | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `qfedudb`.* TO 'qfedu'@'localhost'       | +------------------------------------------------------------------------------- ------------------------------+ 2 rows in set (0.00 sec) mysql> SHOW GRANTS FOR 'qfedu'@'172.16.0.122'; +------------------------------------------------------------------------------- ---------------------------------+ | Grants for [email protected] | +------------------------------------------------------------------------------- ---------------------------------+ | GRANT USAGE ON *.* TO 'qfedu'@'172.16.0.122' IDENTIFIED BY PASSWORD '*841E9705B9F4BD3195B7314CA58A7E3B3B349F71' | | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `qfedudb`.* TO 'qfedu'@'172.16.0.122'       | +------------------------------------------------------------------------------- ---------------------------------+ 2 rows in set (0.01 sec) mysql> \q Bye  

标签:安装,数据库,MySQL,qfedu,yum,mysql,root,com
From: https://www.cnblogs.com/blueas/p/17401719.html

相关文章

  • Centos7下搭建PostgreSQL关系型数据库
     ALTERUSERpostgresENCRYPTEDPASSWORD'postgres123';   10、开放端口firewall-cmd--query-port=5432/tcpfirewall-cmd--add-port=5432/tcpfirewall-cmd--add-port=5432/tcp--zone=public--permanent 11、重新启动systemctlrestartpostgresql-11 ......
  • MYSQL数据库之事务隔离级别详解
    本系列为:MySQL数据库详解,为千锋资深教学老师独家创作致力于为大家讲解清晰MySQL数据库相关知识点,含有丰富的代码案例及讲解。如果感觉对大家有帮助的话,可以【关注】持续追更~文末有本文重点总结,技术类问题,也欢迎大家和我们沟通交流!前言从今天开始本系列内容就带各位小伙伴学习......
  • Nginx编译安装
    1.进入安装目录:#cd/usr/local/src2、下载nginx源码文件nginx网址:http://nginx.org/en/download.html 3、复制文件下载地址:http://nginx.org/download/nginx-1.22.1.tar.gz4、开始下载:#wget http://nginx.org/download/nginx-1.22.1.tar.gz 5、解压#tar-zxvf nginx......
  • Postgresql安装备份注意事项
    1.目标数据库准备     2.口令形式还原数据库主要步骤第一步:需要建一个空白的【hyl_jidian】的数据库;第二步:找到PG库安装位置,进入bin目录,默认位置:C:\ProgramFiles\PostgreSQL\13\bin第三步:执行【psql-hlocalhost-p5432-Upostgres-dhyl_jidian<C:\hyl_jidian......
  • seqkit 软件的安装
     001下载静态软件  wgethttps://github.com/shenwei356/seqkit/releases/download/v2.4.0/seqkit_linux_amd64.tar.gz 002、解压tar-xzvfseqkit_linux_amd64.tar.gz 003、调用测试./seqkit--help|head ......
  • iis url重写模块 安装
    IIS如何安装url重写2023-03-3115:35:33 来源:蓝队云 阅读量:145在使用IIS的过程中,有时我们给网站安装证书后要实现http强制跳转https,这时候我们就需要用到url重写  按照以往的方法只需要在web平台安装程序上安装url重写  但是微软web平台安装程序WebPI已于2022......
  • MySQL 基础内容
    事务Mysql的事务是由一系列的SQL指令所构成的逻辑处理单元,这些指令要么全部执行,要么全部不执行,可以使用COMMIT或ROLLBACK指令来结束一个事务。Mysql中事务的ACID特性:原子性(Atomicity),事务中的所有操作要么全部执行成功,要么全部回滚。一致性(Consistency),事务必须......
  • MySQL的varchar存储原理:InnoDB记录存储结构
    摘要:varchar(M)能存多少个字符,为什么提示最大16383?innodb怎么知道varchar真正有多长?记录为NULL,innodb如何处理?某个列数据占用的字节数非常多怎么办?影响每行实际可用空间的因素有哪些?本篇围绕innodb默认行格式dynamic来说说原理。本文分享自华为云社区《MySQL的varchar水真的太深......
  • windows mysql安装
      [mysqld]#设置3306端口port=3306#设置mysql的安装目录basedir=D:\lvse\mysql-5.7.41-winx64#设置mysql数据库的数据的存放目录datadir=D:\lvse\mysql-5.7.41-winx64\data#允许最大连接数max_connections=200#允许连接失败的次数。这是为了防止有人从该主机试......
  • Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class
    报错代码Loadingclass`com.mysql.jdbc.Driver'.Thisisdeprecated.Thenewdriverclassis`com.mysql.cj.jdbc.Driver'.ThedriverisautomaticallyregisteredviatheSPIandmanualloadingofthedriverclassisgenerallyunnecessary.Exceptionin......