MySql常用简单命令
来源:互联网 发布:mac air windows 驱动 编辑:程序博客网 时间:2024/06/07 02:58
1、启动和停止MySql服务
net stop mysql
net start mysql
2、登录MySql
mysql -u用户名 -p用户密码,例如mysql -uroot -p用root账号登录
3、添加用户及权限
grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码",例如grant select,insert,update,delete on *.* to user1@localhost Identified by "password1";
4、操作数据库
4.1、显示数据库列表。
show databases;
4.2、显示某一个数据库中的数据表
use 数据库名;
show tables;
4.3、显示数据表的结构:
describe 表名;
或desc 表名;或show columns from 表名;
4.4、新建或删除数据库
create database 库名;
drop database 库名;
4.5、新建或删除数据表create table 表名(字段列表);
drop table 表名;
例如;
create table MyClass(
id int(4) not null primary key auto_increment,
name char(20) not null,
sex int(4) not null default '0',
degree double(16,2));
delete from 表名;
4.7、插入数据
insert into 表名 values(值1,值2,...);
或insert into 表名(列1,列2,...) values(值1,值2,...);
4.8、更新数据
update 表名 set 列名1=新值2,列名2=新值2,... where 条件;
4.9、查询数据
select 列名1,列名2 from 表名;
4.10、删除数据
delete from 表名 where 列名1=值1 and 列名2=值2;
5、退出
quit;
或exit;
- MySql常用简单命令
- Linux常用简单命令
- linux常用简单命令
- ASA常用简单命令
- Linux常用简单命令
- LINUX常用简单命令
- 常用MYSQL命令
- 常用MySQL命令
- 常用MySQL命令
- 常用MySQL命令
- 常用MySQL命令
- Mysql 常用的命令
- 常用MySQL命令
- MySQL常用操作命令
- 常用MySQL命令
- MYSQL常用SQL命令
- 常用MySql命令
- 常用MYSQL命令
- 算法导论第六章__实现优先队列
- hdoj 1004 Let the Balloon Rise
- ios检测版本更新
- contextConfigLocatin
- 使用Java代码遍历以获取Map<String,Object>的值
- MySql常用简单命令
- Keepalived原理与实战精讲
- Https(SSL/TLS)原理详解
- Android中Broadcast Receiver组件详解
- XCode环境变量及路径设置
- 简单数论问题
- JSTL标签的用法GOOD
- struts2 返回boolean类型
- C程序获取当前日期和时间(第六章)