千家信息网

Linux基础命令---mysql

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,mysqlmysql 是一个简单的sql shell,它可以用来管理mysql数据库。此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。1 、语法mysql [opt
千家信息网最后更新 2026年11月01日Linux基础命令---mysql

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


数据 数据库 信息 功能 输出 字符 字符集 密码 服务器 用户 结果 网卡 服务 命令 有名 简短 之间 参数 多个 实例 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 南京欣网互联网络科技有限公司 互联网的科技 互联网科技会 盈实互联网科技 长亮科技互联网金融 互联网科技大会 美国互联网前沿科技 联恩商钥互联网科技有限公司 广州优美互联网科技 科技互联网大厂 互联网公司科技股 南平创想时代互联网科技有限公司 天津腾达互联网科技有限公司 长沙茂晟互联网科技有限公司 雨阳互联网卡科技有限公司 美国互联网科技公司 互联网金融运营模式中的金融科技 银川新华互联网科技学校是国营吗 东风日产互联网科技公司叫什么 互联网高科技绘画 上海卓越科技互联网 广州互联网科技公司 安控科技rtu产品工业互联网 卫星互联网科技股票 健康食品互联网创新科技园项目 宁波跨境商互联网科技有限公司 互联网领先科技活动 互联网的科技体现在哪里 安徽九吞吴互联网科技有限公司 现代科技的标志之一的互联网
0