C:phpStudyMySQLin>mysql -uroot -proot -h127.0.0.1 //创建用户 mysql> insert into mysql.user (host,user,password) value('localhost','sqlinuser',password('sqlin')); //删除用户 mysql> delete from mysql.user where user='sqlinuser'; //删除数据库 mysql> drop database magedu; //创建数据库 mysql> create database magedu; mysql> use magedu; //创建表,定义列 mysql> create table admin (id int(100) not null,user varchar(100) not null,password varchar(100) not null) engine=myisam default charset=utf8; //插入记录 mysql> insert into magedu.admin (id,user,password) value('1','mage','123456'); mysql> select * from magedu.admin; //数据库赋权限给用户 mysql> grant all privileges on magedu.* to sqlin@'%'; //普通用户登录验证权限 C:phpStudyMySQLin>mysql -usqlin -psqlin mysql> show databases; mysql> use magedu; mysql> show tables; mysql> select * from admin; +----+------+----------+ | id | user | password | +----+------+----------+ | 1 | mage | 123456 | +----+------+----------+