标签:
建立数据库,建立用户,建表
显示数据库
show databases;
创建数据库
create database db_name;
删除数据库
drop database db_name;
或者
drop database if exists db_name;
使用某个数据库
use db_name;
创建用户并授权
create user user_name@localhost identified by ‘password‘;
grant all privileges on db_name.* to user_name@localhost;
实例:
create user tufujie@localhost identified by ‘123456‘;
grant all privileges on db_name.* to tufujie@localhost;
删除账户及权限:
delete from user where user=‘user_name‘ and host=‘localhost‘;
drop user user_name@‘%‘;
drop user user_name@localhost;
修改指定用户密码
update mysql.user set password=password(‘new_password‘) where user="user_name" and host="localhost";
显示当前数据库中所有的表
show tables;
标签:
原文地址:http://www.cnblogs.com/tufujie/p/4912289.html