.../mysql/bin //mysql操作命令目录
mysql -u '用户名' -p //以用户名进入数据库,接下来会让填写密码,填写对应的密码即可进入数据库
quit; //退出数据库
show databases;//显示当前所有的数据库(mysql命令不区分大小写,且每条命令必须以 ; 为结尾)
use '数据库名'; //进入某个数据库
show tables; //显示当前数据库下的所有列表
select * from '列表名';//显示列表内的所有内容(*可以替换为具体的属性)
show grants for '用户名'@'localhost';//显示用户的权限,这里的localhost是指用户可以在哪里(哪个ip)登陆到该mysql数据库。localhost或者127.0.0.1表示本地,’%’表示所有ip,其他固定ip这表示仅能通过那个ip。只要将localhost换成相应ip或者’%’即可表示远程用户。
flush privileges;//对用户的相关命令操作后需要输入该指令刷新授权表
create database 数据库名; //创建数据库名
drop database 数据库名;//删除数据库名
create table 数据表名(
属性1,
属性2,
属性3,。。。);//创建数据表,创建表必须携带属性
drop table 数据表名;//删除数据表
insert into 数据表名
(属性。。。)
数据类型
(数据。。。);//向插入表中插入数据
权限
all privileges 除grant外的所有权限
select 仅查权限
select,insert 查和插入权限
...
usage 无访问权限
alter 使用alter table
alter routine 使用alter procedure和drop procedure
create 使用create table
create routine 使用create procedure
create temporary tables 使用create temporary tables
create user 使用create user、drop user、rename user和revoke all privileges
create view 使用create view
delete 使用delete
drop 使用drop table
execute 使用call和存储过程
file 使用select into outfile 和 load data infile
grant option 使用grant 和 revoke
index 使用index
insert 使用insert
lock tables 使用lock table
process 使用show full processlist
select 使用select
show databases 使用show databases
show view 使用show view
update 使用update
reload 使用flush
shutdown 使用mysqladmin shutdown(关闭MySQL)
super 使用change master、kill、logs、purge、master和set global。还允许mysqladmin调试登陆
replication client 服务器位置的访问
replication slave 由复制从属使用