MySQL

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: 环境 cenos7准备工作检测名称 hostname -f更新系统 sudo yum update安装Wget yum install wget安装下载并添加存储库,然后进行更新wget http://repo.

环境 cenos7

  • 准备工作
  • 检测名称 hostname -f
  • 更新系统 sudo yum update
  • 安装Wget yum install wget

安装

  1. 下载并添加存储库,然后进行更新

    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
    yum update
    
    
  2. 安装MySQL 并启动, 安装过程中系统将询问您是否要接受.rpm文件的GPG验证结果。如果没有出现错误或不匹配,请输入y

    sudo yum install mysql-server
    sudo systemctl start mysqld
    
    
  3. 初始化服务

    sudo mysql_secure_installation
    
    

    您可以选择更改MySQL root密码,删除匿名用户帐户,禁用localhost之外的root登录,以及删除测试数据库。建议您回答yes这些选项。您可以在MySQL参考手册中阅读有关该脚本的更多信息。

使用

  1. 以root用户身份登录MySQL

    mysql -u root -p
    
    
  2. 查看帮助中心 \h

    For information about MySQL products and services, visit:
    http://www.mysql.com/
    For developer information, including the MySQL Reference Manual, visit:
    http://dev.mysql.com/
    To buy MySQL Enterprise support, training, or other products, visit:
    https://shop.mysql.com/
    
    List of all MySQL commands:
    Note that all text commands must be first on line and end with ';'
    ?         (\?) Synonym for `help'.
    clear     (\c) Clear the current input statement.
    connect   (\r) Reconnect to the server. Optional arguments are db and host.
    delimiter (\d) Set statement delimiter.
    edit      (\e) Edit command with $EDITOR.
    ego       (\G) Send command to mysql server, display result vertically.
    exit      (\q) Exit mysql. Same as quit.
    go        (\g) Send command to mysql server.
    help      (\h) Display this help.
    nopager   (\n) Disable pager, print to stdout.
    notee     (\t) Don't write into outfile.
    pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
    print     (\p) Print current command.
    prompt    (\R) Change your mysql prompt.
    quit      (\q) Quit mysql.
    rehash    (\#) Rebuild completion hash.
    source    (\.) Execute an SQL script file. Takes a file name as an argument.
    status    (\s) Get status information from the server.
    system    (\!) Execute a system shell command.
    tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
    use       (\u) Use another database. Takes database name as argument.
    charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
    warnings  (\W) Show warnings after every statement.
    nowarning (\w) Don't show warnings after every statement.
    
    For server side help, type 'help contents'
    
    
  3. 在下面的示例中,test_db是数据库的名称,tname是用户,password是用户的密码

    create database test_db;
    create user 'tname'@'localhost' identified by 'password';
    grant all on test_db.* to 'tname' identified by 'password';
    
    
  1. 退出

    exit;
    
    
相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
9月前
|
关系型数据库 MySQL
mysql报Toomanyconnection的问题
mysql报Toomanyconnection的问题
264 0
|
存储 关系型数据库 MySQL
【Hello mysql】 mysql数据类型(上)
【Hello mysql】 mysql数据类型
71 0
|
存储 SQL 算法
【Hello mysql】 mysql数据类型(下)
【Hello mysql】 mysql数据类型(下)
77 0
|
5月前
|
SQL NoSQL 关系型数据库
|
9月前
|
网络协议 关系型数据库 MySQL
MySQL服务
【5月更文挑战第23天】MySQL服务
66 1
|
9月前
|
前端开发 关系型数据库 MySQL
(3)mysql怎么这么难
(3)mysql怎么这么难
59 0
|
存储 SQL 关系型数据库
盘点一下Mysql中的一些小知识(四)
盘点一下Mysql中的一些小知识(四)
93 0
|
SQL 安全 关系型数据库
MySQL写马详解
MySQL写马详解
394 0
|
SQL Oracle NoSQL
《MySQL自传》
我是一只勤劳的小海豚,网名叫MySQL,出生于1995年5月23号,正宗95后,你们可别小看我,我现在可是全世界最流行的开源数据库,全球有800万个实例呢。
1090 2
《MySQL自传》
|
存储 关系型数据库 MySQL
【MySQL】MySQL知识总结
【MySQL】MySQL知识总结
1043 0
【MySQL】MySQL知识总结