Linux基础命令---mysql

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: mysql mysql是一个简单的sql shell,它可以用来管理mysql数据库。 此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。1、语法 mysql [options] db 2、参数列表 -? | --help ...

mysql

  mysql是一个简单的sql shell,它可以用来管理mysql数据库。
  此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。

1、语法

  mysql  [options]  db 

2、参数列表

  -? | --help
        显示帮助信息
  --auto-rehash
        激活自动rehash功能
  --bind-address=ip
        绑定ip,当电脑有多个网卡的时候,可以指定mysql连接时的网卡
  --character-sets-dir = path
        指定字符集所在的目录
  --column-names
        在结果中显示列名
  -C | --comments
        在发送给服务器的状态中显示注释
  -c | --compress
        在服务器和客户端之间的数据进行压缩
  -D db | --database=db
        指定数据库名
  --default-character-set=chatset
        默认的字符集
  -e statement | --execute=statement
        指定要使用的指令
  -f | --force
        强制执行
  -H | --html
        输出html格式
  -i | --ignore-spaces
        忽略空格
  --line-numbers
        为错误信息显示行号
  --local-infile=0|1
        关闭或者开启LOAD DATA INFILE功能
  -A | --no-autp-rehash
        关闭自动rehash功能
  -b | --no-beep
        关闭出错提醒
  -p password | --password=
       连接数据库使用的密码
  -W | --pipe
        使用有名管道连接数据库
  -P port | --port=
        连接数据库使用的端口
  --protocol=TCP|SOCKET|PIPI|MEMORY
        连接数据库使用的协议
  -q | --quick
        不缓存查询结果
  -s | --silent
        输出简短的内容
  -v | --verbose
        显示详细执行过程
  -V | --version
        显示版本信息
  -w | --wait
        等待时间
  -X | --xml
        产生xml输出
  -u user | --user=
        连接数据库的用户名,默认是rootq

3、实例
1)登录

  [root@localhost ~]# mysql -u root –p             //使用用户root连接数据库
  Enter password: 
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 5
  Server version: 5.1.71 Source distribution

  Copyright (c) 2000, 2013, 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> quit           //退出
  Bye

2)查看权限

  mysql> show privileges;
  +-------------------------+---------------------------------------+-------------------------------------------------------+
  | Privilege               | Context                               | Comment                                               |
  +-------------------------+---------------------------------------+-------------------------------------------------------+
  | Alter                   | Tables                                | To alter the table                                    |
  | Alter routine           | Functions,Procedures                  | To alter or drop stored functions/procedures          |
  | Create                  | Databases,Tables,Indexes              | To create new databases and tables                    |
  | Create routine          | Databases                             | To use CREATE FUNCTION/PROCEDURE                      |
  | Create temporary tables | Databases                             | To use CREATE TEMPORARY TABLE                         |
  | Create view             | Tables                                | To create new views                                   |
  | Create user             | Server Admin                          | To create new users                                   |
  | Delete                  | Tables                                | To delete existing rows                               |
  | Drop                    | Databases,Tables                      | To drop databases, tables, and views                  |
  | Event                   | Server Admin                          | To create, alter, drop and execute events             |
  | Execute                 | Functions,Procedures                  | To execute stored routines                            |
  | File                    | File access on server                 | To read and write files on the server                 |
  | Grant option            | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess   |
  | Index                   | Tables                                | To create or drop indexes                             |
  | Insert                  | Tables                                | To insert data into tables                            |
  | Lock tables             | Databases                             | To use LOCK TABLES (together with SELECT privilege)   |
  | Process                 | Server Admin                          | To view the plain text of currently executing queries |
  | References              | Databases,Tables                      | To have references on tables                          |
  | Reload                  | Server Admin                          | To reload or refresh tables, logs and privileges      |
  | Replication client      | Server Admin                          | To ask where the slave or master servers are          |
  | Replication slave       | Server Admin                          | To read binary log events from the master             |
  | Select                  | Tables                                | To retrieve rows from table                           |
  | Show databases          | Server Admin                          | To see all databases with SHOW DATABASES              |
  | Show view               | Tables                                | To see views with SHOW CREATE VIEW                    |
  | Shutdown                | Server Admin                          | To shut down the server                               |
  | Super                   | Server Admin                          | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.   |
  | Trigger                 | Tables                                | To use triggers                                       |
  | Update                  | Tables                                | To update existing rows                               |
  | Usage                   | Server Admin                          | No privileges - allow connect only                    |
  +-------------------------+---------------------------------------+-------------------------------------------------------+
  29 rows in set (0.00 sec)
  做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
  链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk 

081634m8n8t2tmz2te95w5

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2天前
|
机器学习/深度学习 缓存 监控
linux查看CPU、内存、网络、磁盘IO命令
`Linux`系统中,使用`top`命令查看CPU状态,要查看CPU详细信息,可利用`cat /proc/cpuinfo`相关命令。`free`命令用于查看内存使用情况。网络相关命令包括`ifconfig`(查看网卡状态)、`ifdown/ifup`(禁用/启用网卡)、`netstat`(列出网络连接,如`-tuln`组合)以及`nslookup`、`ping`、`telnet`、`traceroute`等。磁盘IO方面,`iostat`(如`-k -p ALL`)显示磁盘IO统计,`iotop`(如`-o -d 1`)则用于查看磁盘IO瓶颈。
|
12天前
|
NoSQL Linux Shell
常用的 Linux 命令
常用的 Linux 命令
35 9
|
14天前
|
关系型数据库 MySQL Linux
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
18 0
|
1天前
|
Linux 数据安全/隐私保护
Linux常用命令实例带注释
Linux常用命令实例带注释
13 0
|
1天前
|
Linux 开发工具 数据安全/隐私保护
Linux(19)常用解压命令记录
Linux(19)常用解压命令记录
6 0
|
3天前
|
Linux Perl
Linux系统替换字符串常用命令
请注意,`sed`命令可以非常强大,可以根据不同的需求使用不同的选项和正则表达式来进行更复杂的字符串替换操作。
16 0
|
5天前
|
安全 Linux 开发工具
Linux中可引起文件时间戳改变的相关命令
【4月更文挑战第12天】Linux中可引起文件时间戳改变的相关命令
12 0
|
6天前
|
存储 关系型数据库 MySQL
Linux | MySQL基础
Linux | MySQL基础
|
7天前
|
域名解析 网络协议 Linux
Linux 中的 Nslookup 命令怎么使用?
【4月更文挑战第12天】
25 6
Linux 中的 Nslookup 命令怎么使用?
|
7天前
|
关系型数据库 MySQL Linux
Linux联网安装MySQL Server
Linux联网安装MySQL Server
20 0