mysql命令大全(20211105075513).pdf
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
![preview](https://dl-preview.csdnimg.cn/37798370/0001-7216032e6174ceb6d40896ced07823c1_thumbnail.jpeg)
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
MySQL是一款广泛使用的开源关系型数据库管理系统,其命令行工具提供了丰富的指令来管理数据库。以下是关于MySQL命令的一些关键知识点: 1. **连接MySQL**: - 使用`mysql -h 主机地址 -u 用户名 -p`命令连接MySQL服务器。例如,连接本地MySQL服务,只需输入`mysql -uroot -p`,然后输入密码。 - 远程连接MySQL服务器,需指定IP地址,如`mysql -h110.110.110.110 -uroot -pabcd123`。 - 要退出MySQL,使用`exit`命令。 2. **修改密码**: - 使用`mysqladmin -u 用户名 -p 旧密码 password 新密码`命令修改密码。例如,给root用户设置新密码,先运行`mysqladmin -uroot password 新密码`,如果已有密码,则`mysqladmin -uroot -p旧密码 password 新密码`。 3. **增加新用户**: - 使用`grant`语句添加新用户。如`grant select,insert,update,delete on *.* to 用户名@登录主机 identified by "密码"`,允许用户在所有数据库上执行特定操作。 4. **数据库操作**: - `create database 数据库名;`用于创建新的数据库。 - `use 数据库名;`切换到指定的数据库。 - `drop database 数据库名;`删除数据库,无提示。 - `show tables;`显示当前数据库中的所有表。 - `describe 表名;`查看表结构。 - `select distinct 字段名 from 表名;`去除重复的字段值。 5. **其他命令**: - `mysqladmin drop database 数据库名;`删除数据库前会给出提示。 - `select version(), current_date;`显示MySQL版本和当前日期。 - `update user set password=password("新密码") where user='root';`修改root用户的密码。 - `flush privileges;`刷新权限,使新设置立即生效。 - `grant`语句可创建具有特定权限的新用户,例如`grant all privileges on *.* to '新用户'@'%' identified by '密码';`创建一个可从任何位置连接的全权用户。 6. **用户权限管理**: - `grant`命令用于赋予或撤销用户对数据库或表的操作权限,如`grant select,insert,update,delete on 数据库.表 to '用户名'@'主机' identified by '密码';` 这些只是MySQL命令大全的一部分,实际使用中还有更多复杂的SQL语句和管理技巧,包括视图、存储过程、触发器、索引、事务处理等。掌握这些命令和概念对于有效地管理和维护MySQL数据库至关重要。
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/release/download_crawler_static/37798370/bg1.jpg)
![](https://csdnimg.cn/release/download_crawler_static/37798370/bg2.jpg)
![](https://csdnimg.cn/release/download_crawler_static/37798370/bg3.jpg)
![](https://csdnimg.cn/release/download_crawler_static/37798370/bg4.jpg)
剩余20页未读,继续阅读
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
- 粉丝: 0
- 资源: 6万+
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)