linux下mysql的操作命令
时间: 2023-11-14 18:48:14 浏览: 71
Linux操作MySql的基本命令
1. 连接MySQL服务器:mysql -u username -p password
2. 创建数据库:CREATE DATABASE database_name;
3. 删除数据库:DROP DATABASE database_name;
4. 选择数据库:USE database_name;
5. 查看数据库:SHOW DATABASES;
6. 创建表:CREATE TABLE table_name (column1 datatype, column2 datatype, column3 datatype, ...);
7. 删除表:DROP TABLE table_name;
8. 查看表结构:DESCRIBE table_name;
9. 插入数据:INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
10. 更新数据:UPDATE table_name SET column1=value1, column2=value2, ... WHERE condition;
11. 删除数据:DELETE FROM table_name WHERE condition;
12. 查询数据:SELECT column1, column2, ... FROM table_name WHERE condition;
13. 查看表数据:SELECT * FROM table_name;
14. 退出MySQL:EXIT;
阅读全文