您的位置:首页 > 数据库 > MySQL

MySql命令的基本操作

2014-01-16 17:51 316 查看
MySQL的基本命令:

登录:mysql -h -u root -p

password:*****;

例如:mysql -h127.0.0.1 -uroot -p

增加一个用户: grant all on databasename.tableName to username@localhost identified by 'password';

增加一个本地用户:insert into mysql.user(Host,User,Password) values("Tonge","test",password("a123"));

增加一个远程用户:grant all privileges on*.* to Tonge@"%" identified by 'a123';

解释:grant all 数据库.表名 to 用户名@域 identified by '密码'

查询所有数据库:show databases;

使用数据库:use databaseName;

查看所有表:show tables;

查看表结构:show columns from 表名;

select * from columns where table_name='表名';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: