mysql创建用户并给与一个完整的数据库,怎么写语句

mysql创建用户并给与一个完整的数据库,怎么写语句


牧羊人nacy
浏览 1587回答 4
4回答

繁星coding

1、用管理员登陆mysql2、创建数据库create database db01;3、创建用户user01只能本地访问CREATE USER user01@'localhost' IDENTIFIED BY 'password1';user02可以远程访问CREATE USER user02@'%' IDENTIFIED BY 'password1';4、修改user01密码SET PASSWORD FOR 'user01'@'localhost' = PASSWORD('password2');5、授权a)、user01管理db01全部权限GRANT ALL PRIVILEGES ON db01.* TO user01;b)、user02查看权限,并修改密码GRANT SELECT ON *.* TO 'user02'@'%' IDENTIFIED by 'password2';

千万里不及你

新建普通用户:CREATE USER 'test1'@'localhost' IDENTIFIED BY 'test1'数据库创建:CREATE DATABASE example表的创建:CREATE TABLE example0(id INT,name VARCHAR(20),sex BOOLEAN)

Cats萌萌

DROP DATABASE IF EXISTS userdb;CREATE DATABASE userdb;USE userdb;CREATE TABLE user(id int(11)NOT NULL AUTO_INCREMENT,userName varchar(20) DEFAULT NULL,userPwd varchar(20) DEFAULT NULL,PRIMARY KEY (id))ENGINE=MyISAM DEFAULT CHARSET=latin1;INSERT INTO user(id,userName,userPwd)VALUES(1,'admin','admin');
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

MySQL